[TASK] Remove global declarations inside methods
authorXavier Perseguers <typo3@perseguers.ch>
Wed, 13 Apr 2011 20:24:23 +0000 (22:24 +0200)
committerSteffen Gebert <steffen.gebert@typo3.org>
Wed, 13 Apr 2011 20:35:06 +0000 (22:35 +0200)
Global declaration such as global $TCA or global $BE_USER should
be changed to $GLOBALS['TCA'], $GLOBALS['BE_USER'], ...

Change-Id: I6c4e2cb834e845e2be18d2be3237b57262c061b1
Relates: #25334

typo3/sysext/workspaces/Classes/ExtDirect/Server.php
typo3/sysext/workspaces/Classes/Service/GridData.php

index c7a69bf..75c5956 100644 (file)
@@ -77,11 +77,12 @@ class tx_Workspaces_ExtDirect_Server extends tx_Workspaces_ExtDirect_AbstractHan
         * @return array $data
         */
        public function getRowDetails($parameter) {
-               global $TCA,$BE_USER;
                $diffReturnArray = array();
                $liveReturnArray = array();
 
+               /** @var $t3lib_diff t3lib_diff */
                $t3lib_diff = t3lib_div::makeInstance('t3lib_diff');
+               /** @var $stagesService Tx_Workspaces_Service_Stages */
                $stagesService = t3lib_div::makeInstance('Tx_Workspaces_Service_Stages');
 
                $liveRecord = t3lib_BEfunc::getRecord($parameter->table, $parameter->t3ver_oid);
@@ -93,16 +94,16 @@ class tx_Workspaces_ExtDirect_Server extends tx_Workspaces_ExtDirect_AbstractHan
                $fieldsOfRecords = array_keys($liveRecord);
 
                // get field list from TCA configuration, if available
-               if ($TCA[$parameter->table]) {
-                       if ($TCA[$parameter->table]['interface']['showRecordFieldList']) {
-                               $fieldsOfRecords = $TCA[$parameter->table]['interface']['showRecordFieldList'];
+               if ($GLOBALS['TCA'][$parameter->table]) {
+                       if ($GLOBALS['TCA'][$parameter->table]['interface']['showRecordFieldList']) {
+                               $fieldsOfRecords = $GLOBALS['TCA'][$parameter->table]['interface']['showRecordFieldList'];
                                $fieldsOfRecords = t3lib_div::trimExplode(',',$fieldsOfRecords,1);
                        }
                }
 
                foreach ($fieldsOfRecords as $fieldName) {
                                // check for exclude fields
-                       if ($GLOBALS['BE_USER']->isAdmin() || ($TCA[$parameter->table]['columns'][$fieldName]['exclude'] == 0) || t3lib_div::inList($BE_USER->groupData['non_exclude_fields'],$parameter->table.':'.$fieldName)) {
+                       if ($GLOBALS['BE_USER']->isAdmin() || ($GLOBALS['TCA'][$parameter->table]['columns'][$fieldName]['exclude'] == 0) || t3lib_div::inList($GLOBALS['BE_USER']->groupData['non_exclude_fields'],$parameter->table.':'.$fieldName)) {
                                        // call diff class only if there is a difference
                                if (strcmp($liveRecord[$fieldName],$versionRecord[$fieldName]) !== 0) {
                                                // Select the human readable values before diff
@@ -115,7 +116,7 @@ class tx_Workspaces_ExtDirect_Server extends tx_Workspaces_ExtDirect_AbstractHan
                                                $fieldTitle = $fieldName;
                                        }
 
-                                       if ($TCA[$parameter->table]['columns'][$fieldName]['config']['type'] == 'group' && $TCA[$parameter->table]['columns'][$fieldName]['config']['internal_type'] == 'file') {
+                                       if ($GLOBALS['TCA'][$parameter->table]['columns'][$fieldName]['config']['type'] == 'group' && $GLOBALS['TCA'][$parameter->table]['columns'][$fieldName]['config']['internal_type'] == 'file') {
                                                $versionThumb = t3lib_BEfunc::thumbCode($versionRecord, $parameter->table, $fieldName, '');
                                                $liveThumb = t3lib_BEfunc::thumbCode($liveRecord, $parameter->table, $fieldName, '');
 
index b880680..6226326 100644 (file)
@@ -390,7 +390,6 @@ class tx_Workspaces_Service_GridData {
         * @return integer
         */
        public function calculateChangePercentage($table, array $diffRecordOne, array $diffRecordTwo) {
-               global $TCA;
 
                        // Initialize:
                $changePercentage = 0;
@@ -406,15 +405,15 @@ class tx_Workspaces_Service_GridData {
 
                                // Traversing the first record and process all fields which are editable:
                        foreach ($diffRecordOne as $fieldName => $fieldValue) {
-                               if ($TCA[$table]['columns'][$fieldName] && $TCA[$table]['columns'][$fieldName]['config']['type'] != 'passthrough' && !t3lib_div::inList('t3ver_label', $fieldName)) {
+                               if ($GLOBALS['TCA'][$table]['columns'][$fieldName] && $GLOBALS['TCA'][$table]['columns'][$fieldName]['config']['type'] != 'passthrough' && !t3lib_div::inList('t3ver_label', $fieldName)) {
 
                                        if (strcmp(trim($diffRecordOne[$fieldName]), trim($diffRecordTwo[$fieldName]))
-                                                       && $TCA[$table]['columns'][$fieldName]['config']['type'] == 'group'
-                                                       && $TCA[$table]['columns'][$fieldName]['config']['internal_type'] == 'file'
+                                                       && $GLOBALS['TCA'][$table]['columns'][$fieldName]['config']['type'] == 'group'
+                                                       && $GLOBALS['TCA'][$table]['columns'][$fieldName]['config']['internal_type'] == 'file'
                                        ) {
 
                                                        // Initialize:
-                                               $uploadFolder = $TCA[$table]['columns'][$fieldName]['config']['uploadfolder'];
+                                               $uploadFolder = $GLOBALS['TCA'][$table]['columns'][$fieldName]['config']['uploadfolder'];
                                                $files1 = array_flip(t3lib_div::trimExplode(',', $diffRecordOne[$fieldName], 1));
                                                $files2 = array_flip(t3lib_div::trimExplode(',', $diffRecordTwo[$fieldName], 1));