Commit 94a0e6b8 authored by Stephan Großberndt's avatar Stephan Großberndt Committed by Christian Kuhn
Browse files

[CLEANUP] Replace count with empty in EXT:backend

Replace occurrences of count() with matching empty() pendants.

Resolves: #67960
Releases: master
Change-Id: I0464e5ce1c31d64f0005efcdf5f018239c037ec9
Reviewed-on: http://review.typo3.org/40963


Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 77ccb680
......@@ -172,7 +172,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface {
}
$shortcutMenu[] = '</ul>';
if (count($shortcutMenu) == 2) {
if (count($shortcutMenu) === 2) {
// No shortcuts added yet, show a small help message how to add shortcuts
$title = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.bookmarks', TRUE);
$icon = IconUtility::getSpriteIcon('actions-system-shortcut-new', array(
......
......@@ -421,7 +421,7 @@ class Clipboard {
}
}
}
if (!count($lines)) {
if (empty($lines)) {
$lines[] = '
<tr>
<td class="col-icon"></td>
......@@ -878,7 +878,7 @@ class Clipboard {
* @return bool TRUE if elements exist.
*/
public function isElements() {
return is_array($this->clipData[$this->current]['el']) && count($this->clipData[$this->current]['el']);
return is_array($this->clipData[$this->current]['el']) && !empty($this->clipData[$this->current]['el']);
}
/*****************************************
......
......@@ -1128,7 +1128,7 @@ class EditDocumentController {
$buttons['save_view'] = IconUtility::getSpriteIcon('actions-document-save-view', array('html' => '<input onclick="window.open(\'\', \'newTYPO3frontendWindow\');" type="image" class="c-inputButton" name="_savedokview" src="clear.gif" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDocShow', TRUE) . '" />'));
}
// SAVE / NEW button:
if (count($this->elementsData) == 1 && $this->getNewIconMode($this->firstEl['table'])) {
if (count($this->elementsData) === 1 && $this->getNewIconMode($this->firstEl['table'])) {
$buttons['save_new'] = IconUtility::getSpriteIcon('actions-document-save-new', array('html' => '<input type="image" class="c-inputButton" name="_savedoknew" src="clear.gif" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveNewDoc', TRUE) . '" />'));
}
// SAVE / CLOSE
......@@ -1142,7 +1142,7 @@ class EditDocumentController {
// CLOSE button:
$buttons['close'] = '<a href="#" class="t3js-editform-close" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-close') . '</a>';
// DELETE + UNDO buttons:
if (!$this->errorC && !$GLOBALS['TCA'][$this->firstEl['table']]['ctrl']['readOnly'] && count($this->elementsData) == 1) {
if (!$this->errorC && !$GLOBALS['TCA'][$this->firstEl['table']]['ctrl']['readOnly'] && count($this->elementsData) === 1) {
if ($this->firstEl['cmd'] != 'new' && MathUtility::canBeInterpretedAsInteger($this->firstEl['uid'])) {
// Delete:
if ($this->firstEl['deleteAccess'] && !$GLOBALS['TCA'][$this->firstEl['table']]['ctrl']['readOnly'] && !$this->getNewIconMode($this->firstEl['table'], 'disableDelete')) {
......@@ -1201,7 +1201,7 @@ class EditDocumentController {
*/
public function langSelector() {
$langSelector = '';
if (count($this->elementsData) == 1) {
if (count($this->elementsData) === 1) {
$langSelector = $this->languageSwitch($this->firstEl['table'], $this->firstEl['uid'], $this->firstEl['pid']);
}
return $langSelector;
......
......@@ -1065,7 +1065,7 @@ class PageLayoutController {
$content .= $this->doc->sectionEnd();
}
// Making search form:
if (!$this->modTSconfig['properties']['disableSearchBox'] && count($tableOutput)) {
if (!$this->modTSconfig['properties']['disableSearchBox'] && !empty($tableOutput)) {
$this->markers['BUTTONLIST_ADDITIONAL'] = '<a href="#" onclick="toggleSearchToolbox(); return false;" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.title.searchIcon', TRUE) . '">'.IconUtility::getSpriteIcon('apps-toolbar-menu-search').'</a>';
$this->markers['SEARCHBOX'] = $dbList->getSearchBox(0);
}
......
......@@ -259,7 +259,7 @@ class GroupElement extends AbstractFormElement {
'name' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.allTables'))
);
} elseif ($allowed) {
$onlySingleTableAllowed = count($allowed) == 1;
$onlySingleTableAllowed = count($allowed) === 1;
foreach ($allowed as $allowedTable) {
$allowedTables[] = array(
'name' => htmlspecialchars($languageService->sL($GLOBALS['TCA'][$allowedTable]['ctrl']['title'])),
......
......@@ -170,9 +170,10 @@ class FormDataTraverser {
}
$relatedRow = FALSE;
if (count($possibleUids) === 1) {
$possibleUidsCount = count($possibleUids);
if ($possibleUidsCount === 1) {
$relatedRow = $this->getRecordRow($possibleUids[0]);
} elseif (count($possibleUids) > 1) {
} elseif ($possibleUidsCount > 1) {
$relatedRow = $this->getMatchingRecordRowByTranslation($possibleUids, $fieldConfig);
}
......
......@@ -196,7 +196,7 @@ class DataProvider extends \TYPO3\CMS\Backend\Tree\AbstractTreeDataProvider {
/** @var $nodeCollection \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection */
$nodeCollection = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection::class);
$records = $this->getSubpages(-1, $searchFilter);
if (!is_array($records) || !count($records)) {
if (!is_array($records) || empty($records)) {
return $nodeCollection;
} elseif (count($records) > 500) {
return $nodeCollection;
......
......@@ -614,7 +614,7 @@ abstract class AbstractTreeView {
// must update the stored positions in the tree):
// 0: mount key, 1: set/clear boolean, 2: item ID (cannot contain "_"), 3: treeName
$PM = explode('_', GeneralUtility::_GP('PM'));
if (count($PM) == 4 && $PM[3] == $this->treeName) {
if (count($PM) === 4 && $PM[3] == $this->treeName) {
if (isset($this->MOUNTS[$PM[0]])) {
// set
if ($PM[1]) {
......
......@@ -912,7 +912,7 @@ class BackendUtility {
if (is_array($pArr)) {
foreach ($pArr as $k => $v) {
$parts = explode('=', $v, 2);
if (count($parts) == 2) {
if (count($parts) === 2) {
$out[trim($parts[0])] = trim($parts[1]);
} else {
$out[$k] = $v;
......@@ -963,7 +963,7 @@ class BackendUtility {
// Up to two pointer fields can be specified in a comma separated list.
$pointerFields = GeneralUtility::trimExplode(',', $ds_pointerField);
// If we have two pointer fields, the array keys should contain both field values separated by comma. The asterisk "*" catches all values. For backwards compatibility, it's also possible to specify only the value of the first defined ds_pointerField.
if (count($pointerFields) == 2) {
if (count($pointerFields) === 2) {
if ($ds_array[$row[$pointerFields[0]] . ',' . $row[$pointerFields[1]]]) {
// Check if we have a DS for the combination of both pointer fields values
$srcPointer = $row[$pointerFields[0]] . ',' . $row[$pointerFields[1]];
......@@ -2329,7 +2329,7 @@ class BackendUtility {
}
break;
case 'check':
if (!is_array($theColConf['items']) || count($theColConf['items']) == 1) {
if (!is_array($theColConf['items']) || count($theColConf['items']) === 1) {
$l = $value ? $lang->sL('LLL:EXT:lang/locallang_common.xlf:yes') : $lang->sL('LLL:EXT:lang/locallang_common.xlf:no');
} else {
$lA = array();
......@@ -2812,7 +2812,7 @@ class BackendUtility {
// Traverse the view order, match first occurrence:
$languageOrder = GeneralUtility::intExplode(',', $viewLanguageOrder);
foreach ($languageOrder as $langUid) {
if (is_array($allowedLanguages) && count($allowedLanguages)) {
if (is_array($allowedLanguages) && !empty($allowedLanguages)) {
// Choose if set.
if (isset($allowedLanguages[$langUid])) {
$suffix = '&L=' . $langUid;
......@@ -4212,7 +4212,7 @@ class BackendUtility {
. ' AND A.t3ver_wsid=' . (int)$workspace . ' AND ' . $joinStatement
. self::deleteClause($tableName, 'A') . self::deleteClause($tableName, 'B')
);
if (!is_array($output[$tableName]) || !count($output[$tableName])) {
if (!is_array($output[$tableName]) || empty($output[$tableName])) {
unset($output[$tableName]);
}
}
......
......@@ -559,7 +559,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
}
$pasteP = array('colPos' => $key, 'sys_language_uid' => $lP);
$editParam = $this->doEdit && count($rowArr)
$editParam = $this->doEdit && !empty($rowArr)
? '&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc
: '';
$head[$key] .= $this->tt_content_drawColHeader($colTitle, $editParam, $newP, $pasteP);
......@@ -826,7 +826,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
<td></td>
<td valign="top" colspan="3">' . $this->tt_content_drawColHeader(
BackendUtility::getProcessedValue('tt_content', 'colPos', $key),
$this->doEdit && count($rowArr) ? '&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc : '',
$this->doEdit && !empty($rowArr) ? '&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc : '',
$newP,
$pasteP
) . $theNewButton . '<br /></td>
......
......@@ -162,7 +162,7 @@ class PageTreeView extends \TYPO3\CMS\Backend\Tree\View\BrowseTreeView {
$PM = substr($PM, 0, $PMpos);
}
$PM = explode('_', $PM);
if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX && is_array($PM) && count($PM) == 4 && $PM[2] != 0) {
if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX && is_array($PM) && count($PM) === 4 && $PM[2] != 0) {
if ($PM[1]) {
$expandedPageUid = $PM[2];
$ajaxOutput = '';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment