[TASK] CGL FunctionCallArgumentSpacingNoSpaceAfterComma in indexed_search
authorRoland Waldner <most.wanted@gmx.at>
Sun, 10 Jun 2012 17:22:57 +0000 (19:22 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 11 Jun 2012 17:52:24 +0000 (19:52 +0200)
A few other CGL violations will also be reduced.

Change-Id: Ib7e4ee0d53718a734ba8537f85ff3f234caa78c7
Resolves: #37870
Releases: 6.0
Reviewed-on: http://review.typo3.org/11898
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/indexed_search/class.crawler.php
typo3/sysext/indexed_search/class.external_parser.php
typo3/sysext/indexed_search/class.indexer.php
typo3/sysext/indexed_search/class.lexer.php
typo3/sysext/indexed_search/ext_tables.php
typo3/sysext/indexed_search/modfunc1/class.tx_indexedsearch_modfunc1.php
typo3/sysext/indexed_search/modfunc2/class.tx_indexedsearch_modfunc2.php

index 35efe21..7f88b49 100755 (executable)
@@ -93,7 +93,7 @@ class tx_indexedsearch_crawler {
                                'timer_next_indexing' => $nextTime,
                                'session_data' => '',
                        );
-                       $GLOBALS['TYPO3_DB']->exec_UPDATEquery('index_config','uid='.intval($cfgRec['uid']), $field_array);
+                       $GLOBALS['TYPO3_DB']->exec_UPDATEquery('index_config', 'uid='.intval($cfgRec['uid']), $field_array);
 
                                // Based on configuration type:
                        switch($cfgRec['type']) {
@@ -106,7 +106,7 @@ class tx_indexedsearch_crawler {
                                                'url' => 'Records (start)',     // Just for show.
                                        );
                                                //
-                                       $pObj->addQueueEntry_callBack($setId,$params,$this->callBack,$cfgRec['pid']);
+                                       $pObj->addQueueEntry_callBack($setId, $params, $this->callBack, $cfgRec['pid']);
                                break;
                                case 2: // FILES:
 
@@ -130,7 +130,7 @@ class tx_indexedsearch_crawler {
                                                'depth' => 0    // Specific for URL and file types
                                        );
 
-                                       $pObj->addQueueEntry_callBack($setId,$params,$this->callBack,$cfgRec['pid']);
+                                       $pObj->addQueueEntry_callBack($setId, $params, $this->callBack, $cfgRec['pid']);
                                break;
                                case 4: // Page tree
 
@@ -142,7 +142,7 @@ class tx_indexedsearch_crawler {
                                                'depth' => 0    // Specific for URL and file types and page tree
                                        );
 
-                                       $pObj->addQueueEntry_callBack($setId,$params,$this->callBack,$cfgRec['pid']);
+                                       $pObj->addQueueEntry_callBack($setId, $params, $this->callBack, $cfgRec['pid']);
                                break;
                                case 5: // Meta configuration, nothing to do:
                                        // NOOP
@@ -160,7 +160,7 @@ class tx_indexedsearch_crawler {
                                                                'url' => $hookObj->initMessage($message),
                                                        );
 
-                                                       $pObj->addQueueEntry_callBack($setId,$params,$this->callBack,$cfgRec['pid']);
+                                                       $pObj->addQueueEntry_callBack($setId, $params, $this->callBack, $cfgRec['pid']);
                                                }
                                        }
                                break;
@@ -198,16 +198,16 @@ class tx_indexedsearch_crawler {
                                        // Select which type:
                                switch($cfgRec['type']) {
                                        case 1: // Records:
-                                               $this->crawler_execute_type1($cfgRec,$session_data,$params,$pObj);
+                                               $this->crawler_execute_type1($cfgRec, $session_data, $params, $pObj);
                                        break;
                                        case 2: // Files
-                                               $this->crawler_execute_type2($cfgRec,$session_data,$params,$pObj);
+                                               $this->crawler_execute_type2($cfgRec, $session_data, $params, $pObj);
                                        break;
                                        case 3: // External URL:
-                                               $this->crawler_execute_type3($cfgRec,$session_data,$params,$pObj);
+                                               $this->crawler_execute_type3($cfgRec, $session_data, $params, $pObj);
                                        break;
                                        case 4: // Page tree:
-                                               $this->crawler_execute_type4($cfgRec,$session_data,$params,$pObj);
+                                               $this->crawler_execute_type4($cfgRec, $session_data, $params, $pObj);
                                        break;
                                        case 5: // Meta
                                                // NOOP (should never enter here!)
@@ -218,7 +218,7 @@ class tx_indexedsearch_crawler {
 
                                                        if (is_object($hookObj)) {
                                                                $this->pObj = $pObj;    // For addQueueEntryForHook()
-                                                               $hookObj->indexOperation($cfgRec,$session_data,$params,$this);
+                                                               $hookObj->indexOperation($cfgRec, $session_data, $params, $this);
                                                        }
                                                }
                                        break;
@@ -228,7 +228,7 @@ class tx_indexedsearch_crawler {
                                $field_array = array (
                                        'session_data' => serialize($session_data)
                                );
-                               $GLOBALS['TYPO3_DB']->exec_UPDATEquery('index_config','uid='.intval($cfgRec['uid']), $field_array);
+                               $GLOBALS['TYPO3_DB']->exec_UPDATEquery('index_config', 'uid=' . intval($cfgRec['uid']), $field_array);
                        }
                }
 
@@ -256,7 +256,7 @@ class tx_indexedsearch_crawler {
 
                                // Init:
                        $pid = intval($cfgRec['alternative_source_pid']) ? intval($cfgRec['alternative_source_pid']) : $cfgRec['pid'];
-                       $numberOfRecords = $cfgRec['recordsbatch'] ? t3lib_utility_Math::forceIntegerInRange($cfgRec['recordsbatch'],1) : 100;
+                       $numberOfRecords = $cfgRec['recordsbatch'] ? t3lib_utility_Math::forceIntegerInRange($cfgRec['recordsbatch'], 1) : 100;
 
                                // Get root line:
                        $rl = $this->getUidRootLineForClosestTemplate($cfgRec['pid']);
@@ -279,7 +279,7 @@ class tx_indexedsearch_crawler {
                                foreach($recs as $r) {
 
                                                // Index single record:
-                                       $this->indexSingleRecord($r,$cfgRec,$rl);
+                                       $this->indexSingleRecord($r, $cfgRec, $rl);
 
                                                // Update the UID we last processed:
                                        $session_data['uid'] = $r['uid'];
@@ -288,10 +288,10 @@ class tx_indexedsearch_crawler {
                                        // Finally, set entry for next indexing of batch of records:
                                $nparams = array(
                                        'indexConfigUid' => $cfgRec['uid'],
-                                       'url' => 'Records from UID#'.($r['uid']+1).'-?',
+                                       'url' => 'Records from UID#' . ($r['uid']+1) . '-?',
                                        'procInstructions' => array('[Index Cfg UID#'.$cfgRec['uid'].']')
                                );
-                               $pObj->addQueueEntry_callBack($cfgRec['set_id'],$nparams,$this->callBack,$cfgRec['pid']);
+                               $pObj->addQueueEntry_callBack($cfgRec['set_id'], $nparams, $this->callBack, $cfgRec['pid']);
                        }
                }
        }
@@ -329,13 +329,13 @@ class tx_indexedsearch_crawler {
                                $indexerObj->hash['phash'] = -1;        // EXPERIMENT - but to avoid phash_t3 being written to file sections (otherwise they are removed when page is reindexed!!!)
 
                                        // Index document:
-                               $indexerObj->indexRegularDocument(substr($readpath,strlen(PATH_site)), TRUE);
+                               $indexerObj->indexRegularDocument(substr($readpath, strlen(PATH_site)), TRUE);
                        } elseif (@is_dir($readpath)) { // If dir, read content and create new pending items for log:
 
                                        // Select files and directories in path:
-                               $extList = implode(',',t3lib_div::trimExplode(',',$cfgRec['extensions'],1));
+                               $extList = implode(',', t3lib_div::trimExplode(',', $cfgRec['extensions'], 1));
                                $fileArr = array();
-                               $files = t3lib_div::getAllFilesAndFoldersInPath($fileArr,$readpath,$extList,0,0);
+                               $files = t3lib_div::getAllFilesAndFoldersInPath($fileArr, $readpath, $extList, 0, 0);
 
                                $directoryList = t3lib_div::get_dirs($readpath);
                                if (is_array($directoryList) && $params['depth'] < $cfgRec['depth']) {
@@ -345,7 +345,7 @@ class tx_indexedsearch_crawler {
                                                }
                                        }
                                }
-                               $files = t3lib_div::removePrefixPathFromList($files,PATH_site);
+                               $files = t3lib_div::removePrefixPathFromList($files, PATH_site);
 
                                        // traverse the items and create log entries:
                                foreach($files as $path) {
@@ -396,7 +396,7 @@ class tx_indexedsearch_crawler {
                        // Add more elements to log now:
                if ($params['depth'] < $cfgRec['depth']) {
                        foreach($subUrls as $url) {
-                               if ($url = $this->checkUrl($url,$session_data['urlLog'],$cfgRec['externalUrl'])) {
+                               if ($url = $this->checkUrl($url, $session_data['urlLog'], $cfgRec['externalUrl'])) {
                                        if (!$this->checkDeniedSuburls($url, $cfgRec['url_deny'])) {
                                                $this->instanceCounter++;
                                                $session_data['urlLog'][] = $url;
@@ -436,7 +436,7 @@ class tx_indexedsearch_crawler {
                $pageUid = intval($params['url']);
 
                        // Get array of URLs from page:
-               $pageRow = t3lib_BEfunc::getRecord('pages',$pageUid);
+               $pageRow = t3lib_BEfunc::getRecord('pages', $pageUid);
                $res = $pObj->getUrlsForPageRow($pageRow);
 
                $duplicateTrack = array();      // Registry for duplicates
@@ -526,12 +526,12 @@ class tx_indexedsearch_crawler {
                                $oldPhashRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
                                        'phash',
                                        'index_phash',
-                                       'freeIndexUid='.intval($cfgRec['uid']).' AND freeIndexSetId<>'.$cfgRec['set_id']
+                                       'freeIndexUid=' . intval($cfgRec['uid']) . ' AND freeIndexSetId<>' . $cfgRec['set_id']
                                );
 
                                foreach($oldPhashRows as $pHashRow) {
                                                // Removing old registrations for all tables (code copied from class.tx_indexedsearch_modfunc1.php)
-                                       $tableArr = explode(',','index_phash,index_rel,index_section,index_grlist,index_fulltext,index_debug');
+                                       $tableArr = explode(',', 'index_phash,index_rel,index_section,index_grlist,index_fulltext,index_debug');
                                        foreach($tableArr as $table) {
                                                $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, 'phash='.intval($pHashRow['phash']));
                                        }
@@ -542,7 +542,7 @@ class tx_indexedsearch_crawler {
                                        'set_id' => 0,
                                        'session_data' => '',
                                );
-                               $GLOBALS['TYPO3_DB']->exec_UPDATEquery('index_config','uid='.intval($cfgRec['uid']), $field_array);
+                               $GLOBALS['TYPO3_DB']->exec_UPDATEquery('index_config', 'uid=' . intval($cfgRec['uid']), $field_array);
                        }
                }
        }
@@ -568,12 +568,12 @@ class tx_indexedsearch_crawler {
         * @return      string          Returls the URL if OK, otherwise FALSE
         */
        function checkUrl($url, $urlLog, $baseUrl) {
-               $url = preg_replace('/\/\/$/','/',$url);
-               list($url) = explode('#',$url);
+               $url = preg_replace('/\/\/$/', '/', $url);
+               list($url) = explode('#', $url);
 
-               if (!strstr($url,'../')) {
-                       if (t3lib_div::isFirstPartOfStr($url,$baseUrl)) {
-                               if (!in_array($url,$urlLog)) {
+               if (!strstr($url, '../')) {
+                       if (t3lib_div::isFirstPartOfStr($url, $baseUrl)) {
+                               if (!in_array($url, $urlLog)) {
                                        return $url;
                                }
                        }
@@ -655,13 +655,13 @@ class tx_indexedsearch_crawler {
 
                        // Init:
                $rl = is_array($rl) ? $rl : $this->getUidRootLineForClosestTemplate($cfgRec['pid']);
-               $fieldList = t3lib_div::trimExplode(',',$cfgRec['fieldlist'],1);
+               $fieldList = t3lib_div::trimExplode(',', $cfgRec['fieldlist'], 1);
                $languageField = $GLOBALS['TCA'][$cfgRec['table2index']]['ctrl']['languageField'];
                $sys_language_uid = $languageField ? $r[$languageField] : 0;
 
                        // (Re)-Indexing a row from a table:
                $indexerObj = t3lib_div::makeInstance('tx_indexedsearch_indexer');
-               parse_str(str_replace('###UID###',$r['uid'],$cfgRec['get_params']),$GETparams);
+               parse_str(str_replace('###UID###', $r['uid'], $cfgRec['get_params']), $GETparams);
                $indexerObj->backend_initIndexer($cfgRec['pid'], 0, $sys_language_uid, '', $rl, $GETparams, $cfgRec['chashcalc'] ? TRUE : FALSE);
                $indexerObj->backend_setFreeIndexUid($cfgRec['uid'], $cfgRec['set_id']);
                $indexerObj->forceIndexing = TRUE;
@@ -715,7 +715,8 @@ class tx_indexedsearch_crawler {
                                // Gets the rootLine
                $sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
                $rootLine = $sys_page->getRootLine($id);
-               $tmpl->runThroughTemplates($rootLine,0);        // This generates the constants/config + hierarchy info for the template.
+                       // This generates the constants/config + hierarchy info for the template.
+               $tmpl->runThroughTemplates($rootLine, 0);
 
                        // Root line uids
                $rootline_uids = array();
@@ -737,15 +738,15 @@ class tx_indexedsearch_crawler {
 
                        // Now, find a midnight time to use for offset calculation. This has to differ depending on whether we have frequencies within a day or more than a day; Less than a day, we don't care which day to use for offset, more than a day we want to respect the currently entered day as offset regardless of when the script is run - thus the day-of-week used in case "Weekly" is selected will be respected
                if ($cfgRec['timer_frequency']<=24*3600) {
-                       $aMidNight = mktime (0,0,0)-1*24*3600;
+                       $aMidNight = mktime(0, 0, 0)-1*24*3600;
                } else {
                        $lastTime = $cfgRec['timer_next_indexing'] ? $cfgRec['timer_next_indexing'] : $GLOBALS['EXEC_TIME'];
-                       $aMidNight = mktime (0,0,0, date('m',$lastTime), date('d',$lastTime), date('y',$lastTime));
+                       $aMidNight = mktime(0, 0, 0, date('m', $lastTime), date('d', $lastTime), date('y', $lastTime));
                }
 
                        // Find last offset time plus frequency in seconds:
-               $lastSureOffset = $aMidNight+t3lib_utility_Math::forceIntegerInRange($cfgRec['timer_offset'],0,86400);
-               $frequencySeconds = t3lib_utility_Math::forceIntegerInRange($cfgRec['timer_frequency'],1);
+               $lastSureOffset = $aMidNight + t3lib_utility_Math::forceIntegerInRange($cfgRec['timer_offset'], 0, 86400);
+               $frequencySeconds = t3lib_utility_Math::forceIntegerInRange($cfgRec['timer_frequency'], 1);
 
                        // Now, find out how many blocks of the length of frequency there is until the next time:
                $frequencyBlocksUntilNextTime = ceil(($currentTime-$lastSureOffset)/$frequencySeconds);
@@ -765,10 +766,10 @@ class tx_indexedsearch_crawler {
         */
        function checkDeniedSuburls($url, $url_deny) {
                if (trim($url_deny)) {
-                       $url_denyArray = t3lib_div::trimExplode(LF,$url_deny,1);
+                       $url_denyArray = t3lib_div::trimExplode(LF, $url_deny, 1);
                        foreach($url_denyArray as $testurl) {
-                               if (t3lib_div::isFirstPartOfStr($url,$testurl)) {
-                                       echo $url.' /// '.$url_deny.LF;
+                               if (t3lib_div::isFirstPartOfStr($url, $testurl)) {
+                                       echo $url . ' /// ' . $url_deny.LF;
                                        return TRUE;
                                }
                        }
@@ -790,7 +791,7 @@ class tx_indexedsearch_crawler {
                        'url' => $title,
                        'procInstructions' => array('[Index Cfg UID#'.$cfgRec['uid'].']')       // Also just for information. Its good style to show that its an indexing configuration that added the entry.
                );
-               $this->pObj->addQueueEntry_callBack($cfgRec['set_id'],$nparams,$this->callBack,$cfgRec['pid']);
+               $this->pObj->addQueueEntry_callBack($cfgRec['set_id'], $nparams, $this->callBack, $cfgRec['pid']);
        }
 
        /**
@@ -802,7 +803,7 @@ class tx_indexedsearch_crawler {
        function deleteFromIndex($id) {
 
                        // Lookup old phash rows:
-               $oldPhashRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('phash','index_section', 'page_id='.intval($id));
+               $oldPhashRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('phash', 'index_section', 'page_id=' . intval($id));
 
                if (count($oldPhashRows)) {
                        $pHashesToDelete = array();
@@ -810,7 +811,7 @@ class tx_indexedsearch_crawler {
                                $pHashesToDelete[] = $pHashRow['phash'];
                        }
 
-                       $where_clause = 'phash IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($pHashesToDelete)).')';
+                       $where_clause = 'phash IN (' . implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($pHashesToDelete)) . ')';
                        $tables = explode(',', 'index_debug,index_fulltext,index_grlist,index_phash,index_rel,index_section');
                        foreach ($tables as $table) {
                                $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, $where_clause);
@@ -867,14 +868,14 @@ class tx_indexedsearch_crawler {
                        if ($status=='new') {
                                $id = $pObj->substNEWwithIDs[$id];
 
-                       } elseif ($table=='pages' && $status=='update' && ((array_key_exists('hidden',$fieldArray) && $fieldArray['hidden']==1) || (array_key_exists('no_search',$fieldArray) && $fieldArray['no_search']==1))) {
+                       } elseif ($table == 'pages' && $status == 'update' && ((array_key_exists('hidden', $fieldArray) && $fieldArray['hidden'] == 1) || (array_key_exists('no_search', $fieldArray) && $fieldArray['no_search'] == 1))) {
 
                                        // If the page should be hidden or not indexed after update, delete index for this page
                                $this->deleteFromIndex($id);
                        }
 
                                // Get full record and if exists, search for indexing configurations:
-                       $currentRecord = t3lib_BEfunc::getRecord($table,$id);
+                       $currentRecord = t3lib_BEfunc::getRecord($table, $id);
                        if (is_array($currentRecord)) {
 
                                        // Select all (not running) indexing configurations of type "record" (1) and which points to this table and is located on the same page as the record or pointing to the right source PID
@@ -885,7 +886,7 @@ class tx_indexedsearch_crawler {
                                                AND (starttime=0 OR starttime<=' . $GLOBALS['EXEC_TIME'] . ')
                                                AND set_id=0
                                                AND type=1
-                                               AND table2index='.$GLOBALS['TYPO3_DB']->fullQuoteStr($table,'index_config').'
+                                               AND table2index=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($table, 'index_config') . '
                                                AND (
                                                                (alternative_source_pid=0 AND pid='.intval($currentRecord['pid']).')
                                                                OR (alternative_source_pid='.intval($currentRecord['pid']).')
@@ -895,7 +896,7 @@ class tx_indexedsearch_crawler {
                                );
 
                                foreach($indexingConfigurations as $cfgRec) {
-                                       $this->indexSingleRecord($currentRecord,$cfgRec);
+                                       $this->indexSingleRecord($currentRecord, $cfgRec);
                                }
                        }
                }
index 30c21ed..316b7fe 100755 (executable)
@@ -86,7 +86,7 @@ class tx_indexed_search_extparse {
                $mainExtension = '';
 
                        // Ignore extensions
-               $ignoreExtensions = t3lib_div::trimExplode(',', strtolower($indexerConfig['ignoreExtensions']),1);
+               $ignoreExtensions = t3lib_div::trimExplode(',', strtolower($indexerConfig['ignoreExtensions']), 1);
                if (in_array($extension, $ignoreExtensions)) {
                        $this->pObj->log_setTSlogMessage(sprintf($this->sL('LLL:EXT:indexed_search/locallang.xml:ignoreExtensions'), $extension), 1);
                        return FALSE;
@@ -102,7 +102,7 @@ class tx_indexed_search_extparse {
                                                $this->app['pdfinfo'] = $pdfPath.'pdfinfo'.$exe;
                                                $this->app['pdftotext'] = $pdfPath.'pdftotext'.$exe;
                                                        // PDF mode:
-                                               $this->pdf_mode = t3lib_utility_Math::forceIntegerInRange($indexerConfig['pdf_mode'],-100,100);
+                                               $this->pdf_mode = t3lib_utility_Math::forceIntegerInRange($indexerConfig['pdf_mode'], -100, 100);
                                                $extOK = TRUE;
                                        } else $this->pObj->log_setTSlogMessage(sprintf($this->sL('LLL:EXT:indexed_search/locallang.xml:pdfToolsNotFound'), $pdfPath), 3);
                                } else $this->pObj->log_setTSlogMessage($this->sL('LLL:EXT:indexed_search/locallang.xml:pdfToolsDisabled'), 1);
@@ -234,7 +234,7 @@ class tx_indexed_search_extparse {
                $indexerConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['indexed_search']);
 
                        // Ignore extensions
-               $ignoreExtensions = t3lib_div::trimExplode(',', strtolower($indexerConfig['ignoreExtensions']),1);
+               $ignoreExtensions = t3lib_div::trimExplode(',', strtolower($indexerConfig['ignoreExtensions']), 1);
                if (in_array($extension, $ignoreExtensions)) {
                        return FALSE;
                }
@@ -390,7 +390,7 @@ class tx_indexed_search_extparse {
                                        $pdfInfo = $this->splitPdfInfo($res);
                                        unset($res);
                                        if (intval($pdfInfo['pages'])) {
-                                               list($low,$high) = explode('-',$cPKey);
+                                               list($low, $high) = explode('-', $cPKey);
 
                                                        // Get pdf content:
                                                $tempFileName = t3lib_div::tempnam('Typo3_indexer');            // Create temporary name
@@ -413,7 +413,7 @@ class tx_indexed_search_extparse {
                                if ($this->app['catdoc']) {
                                        $cmd = $this->app['catdoc'] . ' -d utf-8 ' . escapeshellarg($absFile);
                                        t3lib_utility_Command::exec($cmd, $res);
-                                       $content = implode(LF,$res);
+                                       $content = implode(LF, $res);
                                        unset($res);
                                        $contentArr = $this->pObj->splitRegularContent($this->removeEndJunk($content));
                                }
@@ -423,7 +423,7 @@ class tx_indexed_search_extparse {
                                if ($this->app['ppthtml']) {
                                        $cmd = $this->app['ppthtml'] . ' ' . escapeshellarg($absFile);
                                        t3lib_utility_Command::exec($cmd, $res);
-                                       $content = implode(LF,$res);
+                                       $content = implode(LF, $res);
                                        unset($res);
                                        $content = $this->pObj->convertHTMLToUtf8($content);
                                        $contentArr = $this->pObj->splitHTMLContent($this->removeEndJunk($content));
@@ -434,7 +434,7 @@ class tx_indexed_search_extparse {
                                if ($this->app['xlhtml']) {
                                        $cmd = $this->app['xlhtml'] . ' -nc -te ' . escapeshellarg($absFile);
                                        t3lib_utility_Command::exec($cmd, $res);
-                                       $content = implode(LF,$res);
+                                       $content = implode(LF, $res);
                                        unset($res);
                                        $content = $this->pObj->convertHTMLToUtf8($content);
                                        $contentArr = $this->pObj->splitHTMLContent($this->removeEndJunk($content));
@@ -451,16 +451,16 @@ class tx_indexed_search_extparse {
                                                // Read content.xml:
                                        $cmd = $this->app['unzip'] . ' -p ' . escapeshellarg($absFile) . ' content.xml';
                                        t3lib_utility_Command::exec($cmd, $res);
-                                       $content_xml = implode(LF,$res);
+                                       $content_xml = implode(LF, $res);
                                        unset($res);
 
                                                // Read meta.xml:
                                        $cmd = $this->app['unzip'] . ' -p ' . escapeshellarg($absFile) . ' meta.xml';
                                        t3lib_utility_Command::exec($cmd, $res);
-                                       $meta_xml = implode(LF,$res);
+                                       $meta_xml = implode(LF, $res);
                                        unset($res);
 
-                                       $utf8_content = trim(strip_tags(str_replace('<',' <',$content_xml)));
+                                       $utf8_content = trim(strip_tags(str_replace('<', ' <', $content_xml)));
                                        $contentArr = $this->pObj->splitRegularContent($utf8_content);
                                        $contentArr['title'] = basename($absFile);      // Make sure the title doesn't expose the absolute path!
 
@@ -484,7 +484,7 @@ class tx_indexed_search_extparse {
                                if ($this->app['unrtf']) {
                                        $cmd = $this->app['unrtf'] . ' ' . escapeshellarg($absFile);
                                        t3lib_utility_Command::exec($cmd, $res);
-                                       $fileContent = implode(LF,$res);
+                                       $fileContent = implode(LF, $res);
                                        unset($res);
                                        $fileContent = $this->pObj->convertHTMLToUtf8($fileContent);
                                        $contentArr = $this->pObj->splitHTMLContent($fileContent);
@@ -509,11 +509,11 @@ class tx_indexed_search_extparse {
                                $fileContent = t3lib_div::getUrl($absFile);
 
                                        // Finding charset:
-                               preg_match('/^[[:space:]]*<\?xml[^>]+encoding[[:space:]]*=[[:space:]]*["\'][[:space:]]*([[:alnum:]_-]+)[[:space:]]*["\']/i',substr($fileContent,0,200),$reg);
+                               preg_match('/^[[:space:]]*<\?xml[^>]+encoding[[:space:]]*=[[:space:]]*["\'][[:space:]]*([[:alnum:]_-]+)[[:space:]]*["\']/i', substr($fileContent, 0, 200), $reg);
                                $charset = $reg[1] ? $this->pObj->csObj->parse_charset($reg[1]) : 'utf-8';
 
                                        // Converting content:
-                               $fileContent = $this->pObj->convertHTMLToUtf8(strip_tags(str_replace('<',' <',$fileContent)), $charset);
+                               $fileContent = $this->pObj->convertHTMLToUtf8(strip_tags(str_replace('<', ' <', $fileContent)), $charset);
                                $contentArr = $this->pObj->splitRegularContent($fileContent);
                                $contentArr['title'] = basename($absFile);      // Make sure the title doesn't expose the absolute path!
                        break;
@@ -540,7 +540,8 @@ class tx_indexed_search_extparse {
                }
                        // If no title (and why should there be...) then the file-name is set as title. This will raise the hits considerably if the search matches the document name.
                if (is_array($contentArr) && !$contentArr['title']) {
-                       $contentArr['title'] = str_replace('_',' ',basename($absFile)); // Substituting "_" for " " because many filenames may have this instead of a space char.
+                               // Substituting "_" for " " because many filenames may have this instead of a space char.
+                       $contentArr['title'] = str_replace('_', ' ', basename($absFile));
                }
 
                return $contentArr;
@@ -571,7 +572,7 @@ class tx_indexed_search_extparse {
                                        if ($this->pdf_mode>0) {
                                                $iter = ceil($pdfInfo['pages']/$this->pdf_mode);
                                        } else {
-                                               $iter = t3lib_utility_Math::forceIntegerInRange(abs($this->pdf_mode),1,$pdfInfo['pages']);
+                                               $iter = t3lib_utility_Math::forceIntegerInRange(abs($this->pdf_mode), 1, $pdfInfo['pages']);
                                        }
 
                                                // Traverse and create intervals.
@@ -598,7 +599,7 @@ class tx_indexed_search_extparse {
                $res = array();
                if (is_array($pdfInfoArray)) {
                        foreach($pdfInfoArray as $line) {
-                               $parts = explode(':',$line,2);
+                               $parts = explode(':', $line, 2);
                                if (count($parts)>1 && trim($parts[0])) {
                                        $res[strtolower(trim($parts[0]))] = trim($parts[1]);
                                }
@@ -614,7 +615,7 @@ class tx_indexed_search_extparse {
         * @return      string          String
         */
        function removeEndJunk($string) {
-               return trim(preg_replace('/['.LF.chr(12).']*$/','',$string));
+               return trim(preg_replace('/['.LF.chr(12).']*$/', '', $string));
        }
 
 
index 9c1ad55..7ebf53f 100755 (executable)
@@ -145,12 +145,12 @@ class tx_indexedsearch_indexer {
 
                        // Determine if page should be indexed, and if so, configure and initialize indexer
                if ($pObj->config['config']['index_enable']) {
-                       $this->log_push('Index page','');
+                       $this->log_push('Index page', '');
 
                        if (!$indexerConfig['disableFrontendIndexing'] || $this->crawlerActive) {
                                if (!$pObj->page['no_search']) {
                                        if (!$pObj->no_cache) {
-                                               if (!strcmp($pObj->sys_language_uid,$pObj->sys_language_content)) {
+                                               if (!strcmp($pObj->sys_language_uid, $pObj->sys_language_content)) {
 
                                                                // Setting up internal configuration from config array:
                                                        $this->conf = array();
@@ -350,10 +350,10 @@ class tx_indexedsearch_indexer {
 
                        // Indexer configuration from Extension Manager interface:
                $this->indexerConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['indexed_search']);
-               $this->tstamp_minAge = t3lib_utility_Math::forceIntegerInRange($this->indexerConfig['minAge']*3600,0);
-               $this->tstamp_maxAge = t3lib_utility_Math::forceIntegerInRange($this->indexerConfig['maxAge']*3600,0);
-               $this->maxExternalFiles = t3lib_utility_Math::forceIntegerInRange($this->indexerConfig['maxExternalFiles'],0,1000,5);
-               $this->flagBitMask = t3lib_utility_Math::forceIntegerInRange($this->indexerConfig['flagBitMask'],0,255);
+               $this->tstamp_minAge = t3lib_utility_Math::forceIntegerInRange($this->indexerConfig['minAge']*3600, 0);
+               $this->tstamp_maxAge = t3lib_utility_Math::forceIntegerInRange($this->indexerConfig['maxAge']*3600, 0);
+               $this->maxExternalFiles = t3lib_utility_Math::forceIntegerInRange($this->indexerConfig['maxExternalFiles'], 0, 1000, 5);
+               $this->flagBitMask = t3lib_utility_Math::forceIntegerInRange($this->indexerConfig['flagBitMask'], 0, 255);
 
                        // Workaround: If the extension configuration was not updated yet, the value is not existing
                $this->enableMetaphoneSearch = isset($this->indexerConfig['enableMetaphoneSearch']) ? ($this->indexerConfig['enableMetaphoneSearch'] ? TRUE : FALSE) : TRUE;
@@ -443,15 +443,15 @@ class tx_indexedsearch_indexer {
 
                                // Setting message:
                        if ($this->forceIndexing) {
-                               $this->log_setTSlogMessage('Indexing needed, reason: Forced',1);
+                               $this->log_setTSlogMessage('Indexing needed, reason: Forced', 1);
                        } elseif ($check > 0) {
-                               $this->log_setTSlogMessage('Indexing needed, reason: '.$this->reasons[$check],1);
+                               $this->log_setTSlogMessage('Indexing needed, reason: ' . $this->reasons[$check], 1);
                        } else {
-                               $this->log_setTSlogMessage('Indexing needed, reason: Updates gr_list!',1);
+                               $this->log_setTSlogMessage('Indexing needed, reason: Updates gr_list!', 1);
                        }
 
                                        // Divide into title,keywords,description and body:
-                       $this->log_push('Split content','');
+                       $this->log_push('Split content', '');
                                $this->contentParts = $this->splitHTMLContent($this->conf['content']);
                                if ($this->conf['indexedDocTitle']) {
                                        $this->contentParts['title'] = $this->conf['indexedDocTitle'];
@@ -468,27 +468,27 @@ class tx_indexedsearch_indexer {
                        if (!is_array($checkCHash) || $check===1) {
                                $Pstart=t3lib_div::milliseconds();
 
-                               $this->log_push('Converting charset of content ('.$this->conf['metaCharset'].') to utf-8','');
-                                       $this->charsetEntity2utf8($this->contentParts,$this->conf['metaCharset']);
+                               $this->log_push('Converting charset of content (' . $this->conf['metaCharset'] . ') to utf-8', '');
+                                       $this->charsetEntity2utf8($this->contentParts, $this->conf['metaCharset']);
                                $this->log_pull();
 
                                                // Splitting words
-                               $this->log_push('Extract words from content','');
+                               $this->log_push('Extract words from content', '');
                                        $splitInWords = $this->processWordsInArrays($this->contentParts);
                                $this->log_pull();
 
                                                // Analyse the indexed words.
-                               $this->log_push('Analyse the extracted words','');
+                               $this->log_push('Analyse the extracted words', '');
                                        $indexArr = $this->indexAnalyze($splitInWords);
                                $this->log_pull();
 
                                                // Submitting page (phash) record
-                               $this->log_push('Submitting page','');
+                               $this->log_push('Submitting page', '');
                                        $this->submitPage();
                                $this->log_pull();
 
                                                // Check words and submit to word list if not there
-                               $this->log_push('Check word list and submit words','');
+                               $this->log_push('Check word list and submit words', '');
                                        if (tx_indexedsearch_util::isTableUsed('index_words')) {
                                                $this->checkWordList($indexArr);
                                                $this->submitWords($indexArr, $this->hash['phash']);
@@ -496,18 +496,20 @@ class tx_indexedsearch_indexer {
                                $this->log_pull();
 
                                                // Set parsetime
-                               $this->updateParsetime($this->hash['phash'],t3lib_div::milliseconds()-$Pstart);
+                               $this->updateParsetime($this->hash['phash'], t3lib_div::milliseconds() - $Pstart);
 
                                                // Checking external files if configured for.
-                               $this->log_push('Checking external files','');
+                               $this->log_push('Checking external files', '');
                                if ($this->conf['index_externals']) {
                                        $this->extractLinks($this->conf['content']);
                                }
                                $this->log_pull();
                        } else {
-                               $this->updateTstamp($this->hash['phash'],$this->conf['mtime']); // Update the timestatmp
+                                       // Update the timestamp
+                               $this->updateTstamp($this->hash['phash'], $this->conf['mtime']);
                                $this->updateSetId($this->hash['phash']);
-                               $this->update_grlist($checkCHash['phash'],$this->hash['phash']);        // $checkCHash['phash'] is the phash of the result row that is similar to the current phash regarding the content hash.
+                                       // $checkCHash['phash'] is the phash of the result row that is similar to the current phash regarding the content hash.
+                               $this->update_grlist($checkCHash['phash'], $this->hash['phash']);
                                $this->updateRootline();
                                $this->log_setTSlogMessage('Indexing not needed, the contentHash, '.$this->content_md5h.', has not changed. Timestamp, grlist and rootline updated if necessary.');
                        }
@@ -527,19 +529,19 @@ class tx_indexedsearch_indexer {
 
                        // divide head from body ( u-ouh :) )
                $contentArr = $this->defaultContentArray;
-               $contentArr['body'] = stristr($content,'<body');
-               $headPart = substr($content,0,-strlen($contentArr['body']));
+               $contentArr['body'] = stristr($content, '<body');
+               $headPart = substr($content, 0, -strlen($contentArr['body']));
 
                        // get title
-               $this->embracingTags($headPart,'TITLE',$contentArr['title'],$dummy2,$dummy);
-               $titleParts = explode(':',$contentArr['title'],2);
+               $this->embracingTags($headPart, 'TITLE', $contentArr['title'], $dummy2, $dummy);
+               $titleParts = explode(':', $contentArr['title'], 2);
                $contentArr['title'] = trim(isset($titleParts[1]) ? $titleParts[1] : $titleParts[0]);
 
                        // get keywords and description metatags
                if ($this->conf['index_metatags']) {
                        $meta = array();
                        $i = 0;
-                       while ($this->embracingTags($headPart,'meta',$dummy,$headPart, $meta[$i])) {
+                       while ($this->embracingTags($headPart, 'meta', $dummy, $headPart, $meta[$i])) {
                                $i++;
                        }
                                // TODO The code below stops at first unset tag. Is that correct?
@@ -558,13 +560,13 @@ class tx_indexedsearch_indexer {
                $this->typoSearchTags($contentArr['body']);
 
                        // Get rid of unwanted sections (ie. scripting and style stuff) in body
-               $tagList = explode(',',$this->excludeSections);
+               $tagList = explode(',', $this->excludeSections);
                foreach($tagList as $tag) {
-                       while($this->embracingTags($contentArr['body'],$tag,$dummy,$contentArr['body'],$dummy2));
+                       while($this->embracingTags($contentArr['body'], $tag, $dummy, $contentArr['body'], $dummy2));
                }
 
                        // remove tags, but first make sure we don't concatenate words by doing it
-               $contentArr['body'] = str_replace('<',' <',$contentArr['body']);
+               $contentArr['body'] = str_replace('<', ' <', $contentArr['body']);
                $contentArr['body'] = trim(strip_tags($contentArr['body']));
 
                $contentArr['keywords'] = trim($contentArr['keywords']);
@@ -581,8 +583,8 @@ class tx_indexedsearch_indexer {
         * @return      string          The charset value if found.
         */
        function getHTMLcharset($content) {
-               if (preg_match('/<meta[[:space:]]+[^>]*http-equiv[[:space:]]*=[[:space:]]*["\']CONTENT-TYPE["\'][^>]*>/i',$content,$reg)) {
-                       if (preg_match('/charset[[:space:]]*=[[:space:]]*([[:alnum:]-]+)/i',$reg[0],$reg2)) {
+               if (preg_match('/<meta[[:space:]]+[^>]*http-equiv[[:space:]]*=[[:space:]]*["\']CONTENT-TYPE["\'][^>]*>/i', $content, $reg)) {
+                       if (preg_match('/charset[[:space:]]*=[[:space:]]*([[:alnum:]-]+)/i', $reg[0], $reg2)) {
                                return $reg2[1];
                        }
                }
@@ -627,16 +629,19 @@ class tx_indexedsearch_indexer {
                $endTag = '</'.$tagName.'>';
                $startTag = '<'.$tagName;
 
-               $isTagInText = stristr($string,$startTag);              // stristr used because we want a case-insensitive search for the tag.
-               if(!$isTagInText) return FALSE; // if the tag was not found, return FALSE
+                       // stristr used because we want a case-insensitive search for the tag.
+               $isTagInText = stristr($string, $startTag);
+                       // if the tag was not found, return FALSE
+               if(!$isTagInText) return FALSE;
 
-               list($paramList,$isTagInText) = explode('>',substr($isTagInText,strlen($startTag)),2);
-               $afterTagInText = stristr($isTagInText,$endTag);
+               list($paramList, $isTagInText) = explode('>', substr($isTagInText, strlen($startTag)), 2);
+               $afterTagInText = stristr($isTagInText, $endTag);
                if ($afterTagInText) {
                        $stringBefore = substr($string, 0, strpos(strtolower($string), strtolower($startTag)));
-                       $tagContent = substr($isTagInText,0,strlen($isTagInText)-strlen($afterTagInText));
-                       $stringAfter = $stringBefore.substr($afterTagInText,strlen($endTag));
-               } else {        // If there was no ending tag, the tagContent is blank and anything after the tag it self is returned.
+                       $tagContent = substr($isTagInText, 0, strlen($isTagInText) - strlen($afterTagInText));
+                       $stringAfter = $stringBefore . substr($afterTagInText, strlen($endTag));
+                       // If there was no ending tag, the tagContent is blank and anything after the tag it self is returned.
+               } else {
                        $tagContent='';
                        $stringAfter = $isTagInText;
                }
@@ -651,13 +656,13 @@ class tx_indexedsearch_indexer {
         * @return      boolean         Returns TRUE if a TYPOSEARCH_ tag was found, otherwise FALSE.
         */
        function typoSearchTags(&$body) {
-               $expBody = preg_split('/\<\!\-\-[\s]?TYPO3SEARCH_/',$body);
+               $expBody = preg_split('/\<\!\-\-[\s]?TYPO3SEARCH_/', $body);
 
                if(count($expBody)>1) {
                        $body = '';
 
                        foreach($expBody as $val) {
-                               $part = explode('-->',$val,2);
+                               $part = explode('-->', $val, 2);
                                if(trim($part[0])=='begin') {
                                        $body.= $part[1];
                                        $prev = '';
@@ -703,8 +708,8 @@ class tx_indexedsearch_indexer {
                        $qParts = parse_url($linkSource);
 
                                // Check for jumpurl (TYPO3 specific thing...)
-                       if ($qParts['query'] && strstr($qParts['query'],'jumpurl=')) {
-                               parse_str($qParts['query'],$getP);
+                       if ($qParts['query'] && strstr($qParts['query'], 'jumpurl=')) {
+                               parse_str($qParts['query'], $getP);
                                $linkSource = $getP['jumpurl'];
                                $qParts = parse_url($linkSource);       // parse again due to new linkSource!
                        }
@@ -736,8 +741,8 @@ class tx_indexedsearch_indexer {
                                                        );
                                                        unset($params['conf']['content']);
 
-                                                       $crawler->addQueueEntry_callBack(0,$params,'EXT:indexed_search/class.crawler.php:&tx_indexedsearch_files',$this->conf['id']);
-                                                       $this->log_setTSlogMessage('media "'.$params['document'].'" added to "crawler" queue.',1);
+                                                       $crawler->addQueueEntry_callBack(0, $params, 'EXT:indexed_search/class.crawler.php:&tx_indexedsearch_files', $this->conf['id']);
+                                                       $this->log_setTSlogMessage('media "' . $params['document'] . '" added to "crawler" queue.', 1);
                                                } else {
                                                        $this->indexRegularDocument($linkInfo['href'], FALSE, $linkSource, $ext);
                                                }
@@ -748,8 +753,8 @@ class tx_indexedsearch_indexer {
                                                                'conf' => $this->conf
                                                        );
                                                        unset($params['conf']['content']);
-                                                       $crawler->addQueueEntry_callBack(0,$params,'EXT:indexed_search/class.crawler.php:&tx_indexedsearch_files',$this->conf['id']);
-                                                       $this->log_setTSlogMessage('media "'.$params['document'].'" added to "crawler" queue.',1);
+                                                       $crawler->addQueueEntry_callBack(0, $params, 'EXT:indexed_search/class.crawler.php:&tx_indexedsearch_files', $this->conf['id']);
+                                                       $this->log_setTSlogMessage('media "' . $params['document'] . '" added to "crawler" queue.', 1);
                                                } else {
                                                        $this->indexRegularDocument($linkSource);
                                                }
@@ -838,7 +843,7 @@ class tx_indexedsearch_indexer {
 
                        // Get headers:
                $urlHeaders = $this->getUrlHeaders($externalUrl);
-               if (stristr($urlHeaders['Content-Type'],'text/html')) {
+               if (stristr($urlHeaders['Content-Type'], 'text/html')) {
                        $content = $this->indexExternalUrl_content = t3lib_div::getUrl($externalUrl);
                        if (strlen($content)) {
 
@@ -863,11 +868,12 @@ class tx_indexedsearch_indexer {
         * @return      mixed           If no answer, returns FALSE. Otherwise an array where HTTP headers are keys
         */
        function getUrlHeaders($url) {
-               $content = t3lib_div::getUrl($url,2);   // Try to get the headers only
+                       // Try to get the headers only
+               $content = t3lib_div::getUrl($url, 2);
 
                if (strlen($content)) {
                                // Compile headers:
-                       $headers = t3lib_div::trimExplode(LF,$content,1);
+                       $headers = t3lib_div::trimExplode(LF, $content, 1);
                        $retVal = array();
                        foreach($headers as $line) {
                                if (!strlen(trim($line))) {
@@ -1070,33 +1076,33 @@ class tx_indexedsearch_indexer {
                if ($absFile && @is_file($absFile)) {
                        if ($this->external_parsers[$ext]) {
                                $mtime = filemtime($absFile);
-                               $cParts = $this->fileContentParts($ext,$absFile);
+                               $cParts = $this->fileContentParts($ext, $absFile);
 
                                foreach($cParts as $cPKey) {
                                        $this->internal_log = array();
-                                       $this->log_push('Index: '.str_replace('.','_',basename($file)).($cPKey?'#'.$cPKey:''),'');
+                                       $this->log_push('Index: ' . str_replace('.', '_', basename($file)) . ($cPKey ? '#' . $cPKey : ''), '');
                                        $Pstart = t3lib_div::milliseconds();
                                        $subinfo = array('key' => $cPKey);      // Setting page range. This is "0" (zero) when no division is made, otherwise a range like "1-3"
-                                       $phash_arr = $this->file_phash_arr = $this->setExtHashes($file,$subinfo);
+                                       $phash_arr = $this->file_phash_arr = $this->setExtHashes($file, $subinfo);
                                        $check = $this->checkMtimeTstamp($mtime, $phash_arr['phash']);
                                        if ($check > 0 || $force) {
                                                if ($check > 0) {
-                                                       $this->log_setTSlogMessage('Indexing needed, reason: '.$this->reasons[$check],1);
+                                                       $this->log_setTSlogMessage('Indexing needed, reason: ' . $this->reasons[$check], 1);
                                                } else {
-                                                       $this->log_setTSlogMessage('Indexing forced by flag',1);
+                                                       $this->log_setTSlogMessage('Indexing forced by flag', 1);
                                                }
 
                                                        // Check external file counter:
                                                if ($this->externalFileCounter < $this->maxExternalFiles || $force) {
 
                                                                        // Divide into title,keywords,description and body:
-                                                       $this->log_push('Split content','');
-                                                               $contentParts = $this->readFileContent($ext,$absFile,$cPKey);
+                                                       $this->log_push('Split content', '');
+                                                               $contentParts = $this->readFileContent($ext, $absFile, $cPKey);
                                                        $this->log_pull();
 
                                                        if (is_array($contentParts)) {
                                                                        // Calculating a hash over what is to be the actual content. (see indexTypo3PageContent())
-                                                               $content_md5h = tx_indexedsearch_util::md5inthash(implode($contentParts,''));
+                                                               $content_md5h = tx_indexedsearch_util::md5inthash(implode($contentParts, ''));
 
                                                                if ($this->checkExternalDocContentHash($phash_arr['phash_grouping'], $content_md5h) || $force) {
 
@@ -1104,24 +1110,25 @@ class tx_indexedsearch_indexer {
                                                                        $this->externalFileCounter++;
 
                                                                                // Splitting words
-                                                                       $this->log_push('Extract words from content','');
+                                                                       $this->log_push('Extract words from content', '');
                                                                                $splitInWords = $this->processWordsInArrays($contentParts);
                                                                        $this->log_pull();
 
                                                                                // Analyse the indexed words.
-                                                                       $this->log_push('Analyse the extracted words','');
+                                                                       $this->log_push('Analyse the extracted words', '');
                                                                                $indexArr = $this->indexAnalyze($splitInWords);
                                                                        $this->log_pull();
 
                                                                                // Submitting page (phash) record
-                                                                       $this->log_push('Submitting page','');
+                                                                       $this->log_push('Submitting page', '');
                                                                                $size = filesize($absFile);
-                                                                               $ctime = filemtime($absFile);   // Unfortunately I cannot determine WHEN a file is originally made - so I must return the modification time...
-                                                                               $this->submitFilePage($phash_arr,$file,$subinfo,$ext,$mtime,$ctime,$size,$content_md5h,$contentParts);
+                                                                                       // Unfortunately I cannot determine WHEN a file is originally made - so I must return the modification time...
+                                                                               $ctime = filemtime($absFile);
+                                                                               $this->submitFilePage($phash_arr, $file, $subinfo, $ext, $mtime, $ctime, $size, $content_md5h, $contentParts);
                                                                        $this->log_pull();
 
                                                                                // Check words and submit to word list if not there
-                                                                       $this->log_push('Check word list and submit words','');
+                                                                       $this->log_push('Check word list and submit words', '');
                                                                                if (tx_indexedsearch_util::isTableUsed('index_words')) {
                                                                                        $this->checkWordList($indexArr);
                                                                                        $this->submitWords($indexArr, $phash_arr['phash']);
@@ -1129,10 +1136,11 @@ class tx_indexedsearch_indexer {
                                                                        $this->log_pull();
 
                                                                                // Set parsetime
-                                                                       $this->updateParsetime($phash_arr['phash'],t3lib_div::milliseconds()-$Pstart);
+                                                                       $this->updateParsetime($phash_arr['phash'], t3lib_div::milliseconds() - $Pstart);
                                                                } else {
-                                                                       $this->updateTstamp($phash_arr['phash'],$mtime);        // Update the timestamp
-                                                                       $this->log_setTSlogMessage('Indexing not needed, the contentHash, '.$content_md5h.', has not changed. Timestamp updated.');
+                                                                               // Update the timestamp
+                                                                       $this->updateTstamp($phash_arr['phash'], $mtime);
+                                                                       $this->log_setTSlogMessage('Indexing not needed, the contentHash, ' . $content_md5h . ', has not changed. Timestamp updated.');
                                                                }
                                                        } else $this->log_setTSlogMessage('Could not index file! Unsupported extension.');
                                                } else $this->log_setTSlogMessage('The limit of '.$this->maxExternalFiles.' has already been exceeded, so no indexing will take place this time.');
@@ -1178,7 +1186,7 @@ class tx_indexedsearch_indexer {
 
                        // Consult relevant external document parser:
                if (is_object($this->external_parsers[$ext])) {
-                       $cParts = $this->external_parsers[$ext]->fileContentParts($ext,$absFile);
+                       $cParts = $this->external_parsers[$ext]->fileContentParts($ext, $absFile);
                }
 
                return $cParts;
@@ -1235,7 +1243,7 @@ class tx_indexedsearch_indexer {
                                }
 
                                        // decode all numeric / html-entities in the string to real characters:
-                               $contentArr[$key] = $this->csObj->entities_to_utf8($contentArr[$key],TRUE);
+                               $contentArr[$key] = $this->csObj->entities_to_utf8($contentArr[$key], TRUE);
                        }
                }
        }
@@ -1271,9 +1279,9 @@ class tx_indexedsearch_indexer {
        function bodyDescription($contentArr) {
 
                        // Setting description
-               $maxL = t3lib_utility_Math::forceIntegerInRange($this->conf['index_descrLgd'],0,255,200);
+               $maxL = t3lib_utility_Math::forceIntegerInRange($this->conf['index_descrLgd'], 0, 255, 200);
                if ($maxL) {
-                       $bodyDescription = str_replace(array(' ',TAB,CR,LF),' ',$contentArr['body']);
+                       $bodyDescription = str_replace(array(' ', TAB, CR, LF), ' ', $contentArr['body']);
 
                                // Shorten the string:
                        $bodyDescription = $this->csObj->strtrunc('utf-8', $bodyDescription, $maxL);
@@ -1292,10 +1300,10 @@ class tx_indexedsearch_indexer {
                $indexArr = Array();
                $counter = 0;
 
-               $this->analyzeHeaderinfo($indexArr,$content,'title',7);
-               $this->analyzeHeaderinfo($indexArr,$content,'keywords',6);
-               $this->analyzeHeaderinfo($indexArr,$content,'description',5);
-               $this->analyzeBody($indexArr,$content);
+               $this->analyzeHeaderinfo($indexArr, $content, 'title', 7);
+               $this->analyzeHeaderinfo($indexArr, $content, 'keywords', 6);
+               $this->analyzeHeaderinfo($indexArr, $content, 'description', 5);
+               $this->analyzeBody($indexArr, $content);
 
                return $indexArr;
        }
@@ -1330,7 +1338,7 @@ class tx_indexedsearch_indexer {
                        }
 
                                // Priority used for flagBitMask feature (see extension configuration)
-                       $retArr[$val]['cmp'] = $retArr[$val]['cmp']|pow(2,$offset);
+                       $retArr[$val]['cmp'] = $retArr[$val]['cmp']|pow(2, $offset);
 
                                // Increase number of occurences
                        $retArr[$val]['count']++;
@@ -1464,10 +1472,10 @@ class tx_indexedsearch_indexer {
                }
 
                        // PROCESSING index_section
-               $this->submit_section($this->hash['phash'],$this->hash['phash']);
+               $this->submit_section($this->hash['phash'], $this->hash['phash']);
 
                        // PROCESSING index_grlist
-               $this->submit_grlist($this->hash['phash'],$this->hash['phash']);
+               $this->submit_grlist($this->hash['phash'], $this->hash['phash']);
 
                        // PROCESSING index_fulltext
                $fields = array(
@@ -1476,7 +1484,7 @@ class tx_indexedsearch_indexer {
                        'metaphonedata' => $this->metaphoneContent
                );
                if ($this->indexerConfig['fullTextDataLength']>0) {
-                       $fields['fulltextdata'] = substr($fields['fulltextdata'],0,$this->indexerConfig['fullTextDataLength']);
+                       $fields['fulltextdata'] = substr($fields['fulltextdata'], 0, $this->indexerConfig['fullTextDataLength']);
                }
                if (tx_indexedsearch_util::isTableUsed('index_fulltext')) {
                        $GLOBALS['TYPO3_DB']->exec_INSERTquery('index_fulltext', $fields);
@@ -1489,8 +1497,8 @@ class tx_indexedsearch_indexer {
                                'debuginfo' => serialize(array(
                                                'cHashParams' => $this->cHashParams,
                                                'external_parsers initialized' => array_keys($this->external_parsers),
-                                               'conf' => array_merge($this->conf,array('content'=>substr($this->conf['content'],0,1000))),
-                                               'contentParts' => array_merge($this->contentParts,array('body' => substr($this->contentParts['body'],0,1000))),
+                                               'conf' => array_merge($this->conf, array('content'=>substr($this->conf['content'], 0, 1000))),
+                                               'contentParts' => array_merge($this->contentParts, array('body' => substr($this->contentParts['body'], 0, 1000))),
                                                'logs' => $this->internal_log,
                                                'lexer' => $this->lexerObj->debugString,
                                        ))
@@ -1553,7 +1561,7 @@ class tx_indexedsearch_indexer {
         */
        function removeOldIndexedPages($phash) {
                        // Removing old registrations for all tables. Because the pages are TYPO3 pages there can be nothing else than 1-1 relations here.
-               $tableArray = explode(',','index_phash,index_section,index_grlist,index_fulltext,index_debug');
+               $tableArray = explode(',', 'index_phash,index_section,index_grlist,index_fulltext,index_debug');
                foreach ($tableArray as $table) {
                        if (tx_indexedsearch_util::isTableUsed($table)) {
                                $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, 'phash=' . intval($phash));
@@ -1642,7 +1650,7 @@ class tx_indexedsearch_indexer {
                        'metaphonedata' => $this->metaphoneContent
                );
                if ($this->indexerConfig['fullTextDataLength']>0) {
-                       $fields['fulltextdata'] = substr($fields['fulltextdata'],0,$this->indexerConfig['fullTextDataLength']);
+                       $fields['fulltextdata'] = substr($fields['fulltextdata'], 0, $this->indexerConfig['fullTextDataLength']);
                }
                if (tx_indexedsearch_util::isTableUsed('index_fulltext')) {
                        $GLOBALS['TYPO3_DB']->exec_INSERTquery('index_fulltext', $fields);
@@ -1654,7 +1662,7 @@ class tx_indexedsearch_indexer {
                                'phash' => $hash['phash'],
                                'debuginfo' => serialize(array(
                                                'cHashParams' => $subinfo,
-                                               'contentParts' => array_merge($contentParts,array('body' => substr($contentParts['body'],0,1000))),
+                                               'contentParts' => array_merge($contentParts, array('body' => substr($contentParts['body'], 0, 1000))),
                                                'logs' => $this->internal_log,
                                                'lexer' => $this->lexerObj->debugString,
                                        ))
@@ -1692,7 +1700,7 @@ class tx_indexedsearch_indexer {
                if (tx_indexedsearch_util::isTableUsed('index_section')) {
                        $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('phash', 'index_section', 'phash=' . intval($hash) . ' AND page_id=' . intval($this->conf['id']));
                        if ($count == 0) {
-                               $this->submit_section($hash,$this->hash['phash']);
+                               $this->submit_section($hash, $this->hash['phash']);
                        }
                }
        }
@@ -1705,7 +1713,7 @@ class tx_indexedsearch_indexer {
         */
        function removeOldIndexedFiles($phash) {
                        // Removing old registrations for tables.
-               $tableArray = explode(',','index_phash,index_grlist,index_fulltext,index_debug');
+               $tableArray = explode(',', 'index_phash,index_grlist,index_fulltext,index_debug');
                foreach ($tableArray as $table) {
                        if (tx_indexedsearch_util::isTableUsed($table)) {
                                $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, 'phash=' . intval($phash));
@@ -1770,7 +1778,7 @@ class tx_indexedsearch_indexer {
                                                                        $this->log_setTSlogMessage('mtime matched, timestamp NOT updated because a maxAge is set (' . ($row['tstamp'] + $this->tstamp_maxAge - $GLOBALS['EXEC_TIME']) . ' seconds to expire time).', 1);
                                                                } else {
                                                                        $this->updateTstamp($phash);
-                                                                       $this->log_setTSlogMessage('mtime matched, timestamp updated.',1);
+                                                                       $this->log_setTSlogMessage('mtime matched, timestamp updated.', 1);
                                                                }
                                                        }
                                                } else {
@@ -1854,7 +1862,7 @@ class tx_indexedsearch_indexer {
                        $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('phash', 'index_grlist', 'phash=' . intval($phash) . ' AND hash_gr_list=' . tx_indexedsearch_util::md5inthash($this->conf['gr_list']));
                        if ($count == 0) {
                                $this->submit_grlist($phash, $phash_x);
-                               $this->log_setTSlogMessage("Inserted gr_list '".$this->conf['gr_list']."' for phash '".$phash."'",1);
+                               $this->log_setTSlogMessage("Inserted gr_list '" . $this->conf['gr_list'] . "' for phash '" . $phash . "'", 1);
                        }
                }
        }
@@ -2146,7 +2154,9 @@ class tx_indexedsearch_indexer {
         * @return      void
         */
        function log_push($msg, $key) {
-               if (is_object($GLOBALS['TT']))          $GLOBALS['TT']->push($msg,$key);
+               if (is_object($GLOBALS['TT'])) {
+                       $GLOBALS['TT']->push($msg, $key);
+               }
        }
 
        /**
@@ -2166,7 +2176,9 @@ class tx_indexedsearch_indexer {
         * @return      void
         */
        function log_setTSlogMessage($msg, $errorNum=0) {
-               if (is_object($GLOBALS['TT']))          $GLOBALS['TT']->setTSlogMessage($msg,$errorNum);
+               if (is_object($GLOBALS['TT'])) {
+                       $GLOBALS['TT']->setTSlogMessage($msg, $errorNum);
+               }
                $this->internal_log[] = $msg;
        }
 
index 6cbdd47..10f6719 100755 (executable)
@@ -115,14 +115,16 @@ class tx_indexedsearch_lexer {
                $this->debugString = '';
 
                while(1) {
-                       list($start,$len) = $this->get_word($wordString, $pos);
+                       list($start, $len) = $this->get_word($wordString, $pos);
                        if ($len) {
 
-                               $this->addWords($words, $wordString,$start,$len);
+                               $this->addWords($words, $wordString, $start, $len);
 
                                if ($this->debug) {
-                                       $this->debugString.= '<span style="color:red">'.htmlspecialchars(substr($wordString,$pos,$start-$pos)).'</span>'.
-                                                                               htmlspecialchars(substr($wordString,$start,$len));
+                                       $this->debugString .= '<span style="color:red">' .
+                                               htmlspecialchars(substr($wordString, $pos, $start - $pos)) .
+                                               '</span>' .
+                                               htmlspecialchars(substr($wordString, $start, $len));
                                }
 
                                $pos = $start+$len;
@@ -162,7 +164,7 @@ class tx_indexedsearch_lexer {
        function addWords(&$words, &$wordString, $start, $len) {
 
                        // Get word out of string:
-               $theWord = substr($wordString,$start,$len);
+               $theWord = substr($wordString, $start, $len);
 
                        // Get next chars unicode number and find type:
                $bc = 0;
@@ -206,7 +208,7 @@ class tx_indexedsearch_lexer {
                } else {        // Normal "single-byte" chars:
                                // Remove chars:
                        foreach($this->lexerConf['removeChars'] as $skipJoin) {
-                               $theWord = str_replace($this->csObj->UnumberToChar($skipJoin),'',$theWord);
+                               $theWord = str_replace($this->csObj->UnumberToChar($skipJoin), '', $theWord);
                        }
                                // Add word:
                        $words[] = $theWord;
@@ -226,7 +228,7 @@ class tx_indexedsearch_lexer {
 
                        // If return is TRUE, a word was found starting at this position, so returning position and length:
                if ($this->utf8_is_letter($str, $len, $pos)) {
-                       return array($pos,$len);
+                       return array($pos, $len);
                }
 
                        // If the return value was FALSE it means a sequence of non-word chars were found (or blank string) - so we will start another search for the word:
@@ -234,7 +236,7 @@ class tx_indexedsearch_lexer {
                if ($str{$pos} == '')   return FALSE;   // check end of string before looking for word of course.
 
                $this->utf8_is_letter($str, $len, $pos);
-               return array($pos,$len);
+               return array($pos, $len);
        }
 
        /**
@@ -261,10 +263,10 @@ class tx_indexedsearch_lexer {
                        if ($len) {
                                if ($letter)    {       // We are in a sequence of words
                                        if (!$cType     // The char was NOT a letter
-                                                       || ($cType_prev=='cjk' && t3lib_div::inList('num,alpha',$cType)) || ($cType=='cjk' && t3lib_div::inList('num,alpha',$cType_prev))       // ... or the previous and current char are from single-byte sets vs. asian CJK sets
+                                                       || ($cType_prev == 'cjk' && t3lib_div::inList('num,alpha', $cType)) || ($cType == 'cjk' && t3lib_div::inList('num,alpha', $cType_prev)) // ... or the previous and current char are from single-byte sets vs. asian CJK sets
                                                        )       {
                                                        // Check if the non-letter char is NOT a print-join char because then it signifies the end of the word.
-                                               if (!in_array($cp,$this->lexerConf['printjoins'])) {
+                                               if (!in_array($cp, $this->lexerConf['printjoins'])) {
                                                                // If a printjoin start length has been record, set that back now so the length is right (filtering out multiple end chars)
                                                        if ($printJoinLgd) {
                                                                $len = $printJoinLgd;
@@ -286,7 +288,7 @@ class tx_indexedsearch_lexer {
                        if ($str{$pos} == '')   return $letter; // end of string; return status of string till now
 
                                // Get next chars unicode number:
-                       $cp = $this->utf8_ord($str,$bc,$pos);
+                       $cp = $this->utf8_ord($str, $bc, $pos);
                        $pos += $bc;
 
                                // Determine the type:
index 879679a..7d1bb4a 100755 (executable)
@@ -18,7 +18,7 @@ if (t3lib_extMgm::isLoaded('extbase')) {
 }
 
 if (TYPO3_MODE=='BE')    {
-       t3lib_extMgm::addModule('tools','isearch','after:log',t3lib_extMgm::extPath($_EXTKEY).'mod/');
+       t3lib_extMgm::addModule('tools', 'isearch', 'after:log', t3lib_extMgm::extPath($_EXTKEY) . 'mod/');
 
        t3lib_extMgm::insertModuleFunction(
                'web_info',
@@ -35,7 +35,7 @@ if (TYPO3_MODE=='BE')    {
 }
 
 t3lib_extMgm::allowTableOnStandardPages('index_config');
-t3lib_extMgm::addLLrefForTCAdescr('index_config','EXT:indexed_search/locallang_csh_indexcfg.xml');
+t3lib_extMgm::addLLrefForTCAdescr('index_config', 'EXT:indexed_search/locallang_csh_indexcfg.xml');
 
 $TCA['index_config'] = array(
        'ctrl' => array(
index b082b78..99b470c 100755 (executable)
@@ -157,7 +157,7 @@ class tx_indexedsearch_modfunc1 extends t3lib_extobjbase {
                } elseif (t3lib_div::_GET('reindex')) {
                                // Show title / function menu:
                        $theOutput.=$this->pObj->doc->spacer(5);
-                       $theOutput.=$this->pObj->doc->section('Reindexing...', $this->reindexPhash(t3lib_div::_GET('reindex'),t3lib_div::_GET('reindex_id')), 0, 1);
+                       $theOutput.=$this->pObj->doc->section('Reindexing...', $this->reindexPhash(t3lib_div::_GET('reindex'), t3lib_div::_GET('reindex_id')), 0, 1);
 
                } else {        // Detail listings:
                                // Depth function menu:
@@ -793,7 +793,7 @@ class tx_indexedsearch_modfunc1 extends t3lib_extobjbase {
         * @return      string          Wrapped string
         */
        function linkMetaPhoneDetails($string, $metaphone) {
-               return '<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('metaphone'=>$metaphone,'wid'=>'','phash'=>''))).'">'.$string.'</a>';
+               return '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('metaphone' => $metaphone, 'wid'=>'', 'phash' => ''))) . '">' . $string . '</a>';
        }
 
        /**
index 11b9164..ac6b163 100644 (file)
@@ -80,7 +80,7 @@ class tx_indexedsearch_modfunc2 extends t3lib_extobjbase {
 
                $content = $GLOBALS['LANG']->getLL('title2') . '
                        <table cellpading="5" cellspacing="5" valign="top"><tr><td valign="top">' .
-                       $this->listSeveralStats($GLOBALS['LANG']->getLL('all'), $addwhere1,$conf) . '</td><td valign="top">' .
+                       $this->listSeveralStats($GLOBALS['LANG']->getLL('all'), $addwhere1, $conf) . '</td><td valign="top">' .
                        $this->listSeveralStats($GLOBALS['LANG']->getLL('last30days'), $addwhere2, $conf) . '</td><td valign="top">' .
                        $this->listSeveralStats($GLOBALS['LANG']->getLL('last24hours'), $addwhere3, $conf) . '</td></tr></table>' .
                        $this->note;
@@ -180,8 +180,8 @@ class tx_indexedsearch_modfunc2 extends t3lib_extobjbase {
         * @return      string          Returns the list with a comma in the end (if any pages selected!)
         */
        function extGetTreeList($id, $depth, $begin = 0, $perms_clause) {
-               // TODO: Fix this as this calls a non-static method
-               return t3lib_tsfeBeUserAuth::extGetTreeList($id,$depth,$begin,$perms_clause);
+                       // TODO: Fix this as this calls a non-static method
+               return t3lib_tsfeBeUserAuth::extGetTreeList($id, $depth, $begin, $perms_clause);
        }
 
        /**