[CLEANUP] Replace count with empty in EXT:impexp 92/40692/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Sat, 27 Jun 2015 15:24:22 +0000 (17:24 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Mon, 29 Jun 2015 21:57:52 +0000 (23:57 +0200)
Resolves: #67785
Releases: master
Change-Id: I488a505fa811b76e216a3397bf4f1458d4f098df
Reviewed-on: http://review.typo3.org/40692
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/impexp/Classes/Controller/ImportExportController.php
typo3/sysext/impexp/Classes/ImportExport.php
typo3/sysext/impexp/Classes/LocalPageTree.php
typo3/sysext/impexp/Tests/Functional/Export/AbstractExportTestCase.php
typo3/sysext/impexp/Tests/Functional/Export/GroupFileAndFileReferenceItem/ExportTest.php
typo3/sysext/impexp/Tests/Functional/Export/GroupFileAndFileReferenceItemInFlexForm/ExportTest.php
typo3/sysext/impexp/Tests/Functional/Export/IrreTutorialRecords/ExportTest.php
typo3/sysext/impexp/Tests/Functional/Export/PagesAndTtContent/ExportTest.php
typo3/sysext/impexp/Tests/Functional/Export/PagesAndTtContentWithImages/ExportTest.php
typo3/sysext/impexp/Tests/Functional/Export/PagesAndTtContentWithRteImagesAndFileLink/ExportTest.php

index 4216096..d5968aa 100644 (file)
@@ -306,7 +306,7 @@ class ImportExportController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
                                        }
                                        $idH = array();
                                        $idH[$pid]['uid'] = $pid;
-                                       if (count($tree->buffer_idH)) {
+                                       if (!empty($tree->buffer_idH)) {
                                                $idH[$pid]['subrow'] = $tree->buffer_idH;
                                        }
                                        $pagetree = GeneralUtility::makeInstance(\TYPO3\CMS\Impexp\LocalPageTree::class);
@@ -327,7 +327,7 @@ class ImportExportController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
                // After adding ALL records we set relations:
                for ($a = 0; $a < 10; $a++) {
                        $addR = $this->export->export_addDBRelations($a);
-                       if (!count($addR)) {
+                       if (empty($addR)) {
                                break;
                        }
                }
@@ -650,7 +650,7 @@ class ImportExportController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
                                $excludeHiddenFields .= '<input type="hidden" name="tx_impexp[exclude][' . $key . ']" value="1" />';
                        }
                }
-               if (count($inData['exclude'])) {
+               if (!empty($inData['exclude'])) {
                        $excludedElements = '<em>' . implode(', ', array_keys($inData['exclude'])) . '</em><hr/><label for="checkExclude">'
                                . $this->lang->getLL('makeconfig_clearAllExclusions', TRUE)
                                . '</label> <input type="checkbox" name="tx_impexp[exclude]" id="checkExclude" value="1" />';
@@ -1074,12 +1074,12 @@ class ImportExportController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
                                                        }
                                                }
                                        }
-                                       if (count($extKeysToInstall)) {
+                                       if (!empty($extKeysToInstall)) {
                                                $extensionInstallationMessage = 'Before you can install this T3D file you need to install the extensions "'
                                                        . implode('", "', $extKeysToInstall) . '".';
                                        }
                                        if ($inData['import_file']) {
-                                               if (!count($extKeysToInstall)) {
+                                               if (empty($extKeysToInstall)) {
                                                        $import->importData($this->id);
                                                        BackendUtility::setUpdateSignal('updatePageTree');
                                                }
@@ -1442,7 +1442,7 @@ class ImportExportController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
                        }
                }
                // Add to clause:
-               if (count($pageIds)) {
+               if (!empty($pageIds)) {
                        return ' AND uid NOT IN (' . implode(',', $pageIds) . ')';
                }
                return '';
index 1b72628..428ebae 100644 (file)
@@ -42,7 +42,7 @@ use TYPO3\CMS\Core\Utility\PathUtility;
  * Adding all the relations (recursively in 5 levels so relations has THEIR relations registered as well)
  * for($a=0;$a<5;$a++) {
  * $addR = $this->export->export_addDBRelations($a);
- * if (!count($addR)) break;
+ * if (empty($addR)) break;
  * }
  *
  * Finally load all the files.
@@ -1893,7 +1893,7 @@ class ImportExport {
                                }
                        }
                        // Then add all remaining pages not in tree on root level:
-                       if (count($pageRecords)) {
+                       if (!empty($pageRecords)) {
                                $remainingPageUids = array_keys($pageRecords);
                                foreach ($remainingPageUids as $pUid) {
                                        $this->addSingle('pages', $pUid, $pid);
@@ -1948,7 +1948,7 @@ class ImportExport {
                        }
                }
                // Execute the move commands if any:
-               if (count($cmd_data)) {
+               if (!empty($cmd_data)) {
                        $tce = $this->getNewTCE();
                        $this->callHook('before_writeRecordsPagesOrder', array(
                                'tce' => &$tce,
@@ -2059,7 +2059,7 @@ class ImportExport {
                        }
                }
                // Execute the move commands if any:
-               if (count($cmd_data)) {
+               if (!empty($cmd_data)) {
                        $tce = $this->getNewTCE();
                        $this->callHook('before_writeRecordsRecordsOrder', array(
                                'tce' => &$tce,
@@ -2275,14 +2275,14 @@ class ImportExport {
                                                }
                                                switch ((string)$config['type']) {
                                                        case 'db':
-                                                               if (is_array($config['itemArray']) && count($config['itemArray'])) {
+                                                               if (is_array($config['itemArray']) && !empty($config['itemArray'])) {
                                                                        $itemConfig = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
                                                                        $valArray = $this->setRelations_db($config['itemArray'], $itemConfig);
                                                                        $updateData[$table][$thisNewUid][$field] = implode(',', $valArray);
                                                                }
                                                                break;
                                                        case 'file':
-                                                               if (is_array($config['newValueFiles']) && count($config['newValueFiles'])) {
+                                                               if (is_array($config['newValueFiles']) && !empty($config['newValueFiles'])) {
                                                                        $valArr = array();
                                                                        foreach ($config['newValueFiles'] as $fI) {
                                                                                $valArr[] = $this->import_addFileNameToBeCopied($fI);
@@ -2344,7 +2344,7 @@ class ImportExport {
                                $this->error('Error: this records is NOT created it seems! (' . $table . ':' . $uid . ')', 1);
                        }
                }
-               if (count($updateData)) {
+               if (!empty($updateData)) {
                        $tce = $this->getNewTCE();
                        $tce->isImporting = TRUE;
                        $this->callHook('before_setRelation', array(
@@ -2482,7 +2482,7 @@ class ImportExport {
                                                // Get XML content and set as default value (string, non-processed):
                                                $updateData[$table][$thisNewUid][$field] = $this->dat['records'][$table . ':' . $uid]['data'][$field];
                                                // If there has been registered relations inside the flex form field, run processing on the content:
-                                               if (count($config['flexFormRels']['db']) || count($config['flexFormRels']['file'])) {
+                                               if (!empty($config['flexFormRels']['db']) || !empty($config['flexFormRels']['file'])) {
                                                        $origRecordRow = BackendUtility::getRecord($table, $thisNewUid, '*');
                                                        // This will fetch the new row for the element (which should be updated with any references to data structures etc.)
                                                        $conf = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
@@ -2511,7 +2511,7 @@ class ImportExport {
                                }
                        }
                }
-               if (count($updateData)) {
+               if (!empty($updateData)) {
                        $tce = $this->getNewTCE();
                        $tce->isImporting = TRUE;
                        $this->callHook('before_setFlexFormRelations', array(
@@ -2661,7 +2661,7 @@ class ImportExport {
                                }
                        }
                        // If any was found, do processing:
-                       if (count($thisSoftRefCfgList)) {
+                       if (!empty($thisSoftRefCfgList)) {
                                // Get tokenizedContent string and proceed only if that is not blank:
                                $tokenizedContent = $this->dat['records'][$table . ':' . $origUid]['rels'][$field]['flexFormRels']['softrefs'][$path]['tokenizedContent'];
                                if (strlen($tokenizedContent)) {
@@ -3427,7 +3427,7 @@ class ImportExport {
                                        $this->traversePageRecords($this->remainHeader['records']['pages'], $lines);
                                }
                                $this->traverseAllRecords($this->remainHeader['records'], $lines);
-                               if (count($lines)) {
+                               if (!empty($lines)) {
                                        $rows = array();
                                        $rows[] = '
                                        <tr class="bgColor5 tableheader">
@@ -3670,7 +3670,7 @@ class ImportExport {
                        $this->addRelations($record['rels'], $lines, $preCode);
                }
                // Soft ref
-               if (count($record['softrefs'])) {
+               if (!empty($record['softrefs'])) {
                        $preCode_A = $preCode . '&nbsp;&nbsp;&nbsp;&nbsp;';
                        $preCode_B = $preCode . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
                        foreach ($record['softrefs'] as $info) {
@@ -4132,7 +4132,7 @@ class ImportExport {
                                }
                        }
                        // Create output:
-                       if (count($output)) {
+                       if (!empty($output)) {
                                $tRows = array();
                                foreach ($output as $fN => $state) {
                                        $tRows[] = '
@@ -4218,7 +4218,7 @@ class ImportExport {
         * @return string HTML print of error log
         */
        public function printErrorLog() {
-               return count($this->errorLog) ? \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($this->errorLog) : '';
+               return !empty($this->errorLog) ? \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($this->errorLog) : '';
        }
 
 }
index 9a85732..89de2da 100644 (file)
@@ -121,7 +121,7 @@ class LocalPageTree extends \TYPO3\CMS\Backend\Tree\View\BrowseTreeView {
                        $this->getTree($pid, 999, $depthD);
                        $idH = array();
                        $idH[$pid]['uid'] = $pid;
-                       if (count($this->buffer_idH)) {
+                       if (!empty($this->buffer_idH)) {
                                $idH[$pid]['subrow'] = $this->buffer_idH;
                        }
                        $this->buffer_idH = $idH;
index e109233..6f20e5b 100644 (file)
@@ -73,7 +73,7 @@ abstract class AbstractExportTestCase extends \TYPO3\CMS\Core\Tests\FunctionalTe
                }
 
                $idH[$pidToStart]['uid'] = $pidToStart;
-               if (count($tree->buffer_idH)) {
+               if (!empty($tree->buffer_idH)) {
                        $idH[$pidToStart]['subrow'] = $tree->buffer_idH;
                }
 
index 168562d..732bf0b 100644 (file)
@@ -142,7 +142,7 @@ class ExportTest extends \TYPO3\CMS\Impexp\Tests\Functional\Export\AbstractExpor
                // After adding ALL records we set relations:
                for ($a = 0; $a < 10; $a++) {
                        $addR = $this->export->export_addDBRelations($a);
-                       if (!count($addR)) {
+                       if (empty($addR)) {
                                break;
                        }
                }
index 39b6fb2..1a23839 100644 (file)
@@ -113,7 +113,7 @@ class ExportTest extends \TYPO3\CMS\Impexp\Tests\Functional\Export\AbstractExpor
                // After adding ALL records we set relations:
                for ($a = 0; $a < 10; $a++) {
                        $addR = $this->export->export_addDBRelations($a);
-                       if (!count($addR)) {
+                       if (empty($addR)) {
                                break;
                        }
                }
index 7193b28..6a8c116 100644 (file)
@@ -285,7 +285,7 @@ class ExportTest extends \TYPO3\CMS\Impexp\Tests\Functional\Export\AbstractExpor
                // After adding ALL records we set relations:
                for ($a = 0; $a < 10; $a++) {
                        $addR = $this->export->export_addDBRelations($a);
-                       if (!count($addR)) {
+                       if (empty($addR)) {
                                break;
                        }
                }
index cbdbbc4..2af1227 100644 (file)
@@ -96,7 +96,7 @@ class ExportTest extends \TYPO3\CMS\Impexp\Tests\Functional\Export\AbstractExpor
                // After adding ALL records we set relations:
                for ($a = 0; $a < 10; $a++) {
                        $addR = $this->export->export_addDBRelations($a);
-                       if (!count($addR)) {
+                       if (empty($addR)) {
                                break;
                        }
                }
index 2864303..4627c0d 100644 (file)
@@ -192,7 +192,7 @@ class ExportTest extends \TYPO3\CMS\Impexp\Tests\Functional\Export\AbstractExpor
                // After adding ALL records we set relations:
                for ($a = 0; $a < 10; $a++) {
                        $addR = $this->export->export_addDBRelations($a);
-                       if (!count($addR)) {
+                       if (empty($addR)) {
                                break;
                        }
                }
index 36917a3..d68618c 100644 (file)
@@ -115,7 +115,7 @@ class ExportTest extends \TYPO3\CMS\Impexp\Tests\Functional\Export\AbstractExpor
                // After adding ALL records we set relations:
                for ($a = 0; $a < 10; $a++) {
                        $addR = $this->export->export_addDBRelations($a);
-                       if (!count($addR)) {
+                       if (empty($addR)) {
                                break;
                        }
                }