[+TASK] Code clean-up
authorjocrau <jocrau@735d13b6-9817-0410-8766-e36946ffe9aa>
Mon, 30 Jul 2012 14:47:12 +0000 (14:47 +0000)
committerBastian Bringenberg <spam@bastian-bringenberg.de>
Thu, 4 Dec 2014 23:56:08 +0000 (00:56 +0100)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/contagged/trunk@64955 735d13b6-9817-0410-8766-e36946ffe9aa

12 files changed:
class.tx_contagged.php
doc/cooluri_example.xml
doc/realurl_example.php
ext_localconf.php
ext_tables.php
locallang_db.xml
model/class.tx_contagged_model_mapper.php
model/class.tx_contagged_model_terms.php
pi1/class.tx_contagged_pi1.php
pi1/locallang.xml
tca.php
tx_contagged_userfunction.php

index 184e451..5779e9c 100644 (file)
@@ -1,40 +1,37 @@
 <?php
 /***************************************************************
-       *  Copyright notice
-       *
-       *  (c) 2007 Jochen Rau <j.rau@web.de>
-       *  All rights reserved
-       *
-       *  This script is part of the TYPO3 project. The TYPO3 project is
-       *  free software; you can redistribute it and/or modify
-       *  it under the terms of the GNU General Public License as published by
-       *  the Free Software Foundation; either version 2 of the License, or
-       *  (at your option) any later version.
-       *
-       *  The GNU General Public License can be found at
-       *  http://www.gnu.org/copyleft/gpl.html.
-       *
-       *  This script is distributed in the hope that it will be useful,
-       *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-       *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-       *  GNU General Public License for more details.
-       *
-       *  This copyright notice MUST APPEAR in all copies of the script!
-       ***************************************************************/
-
-require_once (PATH_tslib.'class.tslib_pibase.php');
-require_once (PATH_t3lib.'class.t3lib_parsehtml.php');
-require_once (t3lib_extMgm::extPath('contagged').'model/class.tx_contagged_model_terms.php');
+ *  Copyright notice
+ *  (c) 2007 Jochen Rau <j.rau@web.de>
+ *  All rights reserved
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
+ *  GNU General Public License for more details.
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+require_once (PATH_tslib . 'class.tslib_pibase.php');
+require_once (PATH_t3lib . 'class.t3lib_parsehtml.php');
+require_once (t3lib_extMgm::extPath('contagged') . 'model/class.tx_contagged_model_terms.php');
 
 /**
  * The main class to parse,tag and replace specific terms of the content.
  *
- * @author     Jochen Rau <j.rau@web.de>
+ * @author    Jochen Rau <j.rau@web.de>
  * @package TYPO3
- * @subpackage tx_contagged
+ * @subpackage    tx_contagged
  */
 class tx_contagged extends tslib_pibase {
+
        var $prefixId = 'tx_contagged';
+
        var $scriptRelPath = 'class.tx_contagged.php'; // path to this script relative to the extension dir
        var $extKey = 'contagged'; // the extension key
        var $conf; // the TypoScript configuration array
@@ -43,26 +40,26 @@ class tx_contagged extends tslib_pibase {
        /**
         * The main method. It instantly delegates the process to the parse function.
         *
-        * @param       string          $content: The content
-        * @param       array           $conf: The configuration array
-        * @return      string          The parsed and tagged content that is displayed on the website
+        * @param    string        $content: The content
+        * @param    array        $conf: The configuration array
+        * @return    string        The parsed and tagged content that is displayed on the website
         */
        public function main($content, $conf = NULL) {
                return $this->parse($content, $conf);
        }
-       
+
        /**
         * This method is to parse, tag and link specific terms in the given content.
         *
-        * @param       string          $content: The content
-        * @param       array           $conf: The configuration array
-        * @return      string          The parsed and tagged content that is displayed on the website
+        * @param    string        $content: The content
+        * @param    array        $conf: The configuration array
+        * @return    string        The parsed and tagged content that is displayed on the website
         */
        public function parse($content, $conf) {
                if (!is_array($conf)) {
                        $conf = array();
                }
-               $this->conf = t3lib_div::array_merge_recursive_overrule($GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId.'.'], $conf);
+               $this->conf = t3lib_div::array_merge_recursive_overrule($GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId . '.'], $conf);
                $this->pi_setPiVarDefaults();
                if (!is_object($this->cObj)) {
                        $this->cObj = t3lib_div::makeInstance('tslib_cObj');
@@ -77,8 +74,10 @@ class tx_contagged extends tslib_pibase {
                $this->typolinkConf['useCacheHash'] = 1;
 
                // exit if the content should be skipped
-               if ($this->isContentToSkip()) return $content;          
-               
+               if ($this->isContentToSkip()) {
+                       return $content;
+               }
+
                // get an array of all type configurations
                $this->typesArray = $this->conf['types.'];
 
@@ -89,40 +88,44 @@ class tx_contagged extends tslib_pibase {
                $excludeTerms = explode(',', $this->conf['excludeTerms']);
                $sortedTerms = array();
                foreach ($this->termsArray as $termKey => $termArray) {
-                       if ($this->conf['autoExcludeTerms'] == 1 && in_array($termArray['term_main'], $excludeTerms)) continue;
+                       if ($this->conf['autoExcludeTerms'] == 1 && in_array($termArray['term_main'], $excludeTerms)) {
+                               continue;
+                       }
                        $sortedTerms[] = array('term' => $termArray['term_main'], 'key' => $termKey);
                        if (is_array($termArray['term_alt'])) {
                                foreach ($termArray['term_alt'] as $term) {
-                                       if ($this->conf['autoExcludeTerms'] == 1 && in_array($term, $excludeTerms)) continue;
+                                       if ($this->conf['autoExcludeTerms'] == 1 && in_array($term, $excludeTerms)) {
+                                               continue;
+                                       }
                                        $sortedTerms[] = array('term' => $term, 'key' => $termKey);
                                }
                        }
                }
-               
+
                // sort the array descending by length of the value, so the longest term will match
-               usort($sortedTerms,array($this,'sortArrayByLengthDescending'));
+               usort($sortedTerms, array($this, 'sortArrayByLengthDescending'));
 
                // get a comma separated list of all tags which should be omitted
                $tagsToOmitt = $this->getTagsToOmitt();
 
                // TODO split recursively
                $parseObj = t3lib_div::makeInstance('t3lib_parsehtml');
-               $splittedContent = $parseObj->splitIntoBlock($tagsToOmitt,$content);
-               foreach((array)$splittedContent as $intKey => $HTMLvalue) {
-                       if (!($intKey%2)) {
+               $splittedContent = $parseObj->splitIntoBlock($tagsToOmitt, $content);
+               foreach ((array)$splittedContent as $intKey => $HTMLvalue) {
+                       if (!($intKey % 2)) {
                                $positionsArray = array();
-                                       foreach ($sortedTerms as $termAndKey) {
-                                               if (empty($termAndKey['term'])) {
-                                                       continue;
-                                               }
-                                               $this->getPositions($splittedContent[$intKey],$positionsArray,$termAndKey['term'],$termAndKey['key']);
+                               foreach ($sortedTerms as $termAndKey) {
+                                       if (empty($termAndKey['term'])) {
+                                               continue;
                                        }
+                                       $this->getPositions($splittedContent[$intKey], $positionsArray, $termAndKey['term'], $termAndKey['key']);
+                               }
                                ksort($positionsArray);
-                               $splittedContent[$intKey] = $this->doReplace($splittedContent[$intKey],$positionsArray);                        
+                               $splittedContent[$intKey] = $this->doReplace($splittedContent[$intKey], $positionsArray);
                        }
                }
-               $parsedContent = implode('',$splittedContent);
-               
+               $parsedContent = implode('', $splittedContent);
+
                // update the keywords (field "tx_contagged_keywords" in table "page")
                if ($this->conf['updateKeywords'] > 0) {
                        $this->updatePageKeywords();
@@ -132,50 +135,51 @@ class tx_contagged extends tslib_pibase {
                return $parsedContent;
        }
 
-       function sortArrayByLengthDescending($a,$b) {
-               if (strlen($a['term'])==strlen($b['term'])) {
+       function sortArrayByLengthDescending($a, $b) {
+               if (strlen($a['term']) == strlen($b['term'])) {
                        return 0;
                }
-               return strlen($a['term'])<strlen($b['term']) ? 1 : -1;
+               return strlen($a['term']) < strlen($b['term']) ? 1 : -1;
        }
-       
-       function getPositions($content,&$positionsArray,$term,$termKey) {
+
+       function getPositions($content, &$positionsArray, $term, $termKey) {
                $termArray = $this->termsArray[$termKey];
                $typeConfigArray = $this->typesArray[$termArray['term_type'] . '.'];
                if ($typeConfigArray['termIsRegEx'] > 0) {
-                       $regEx = $termArray['term_main'].$this->conf['modifier'];
+                       $regEx = $termArray['term_main'] . $this->conf['modifier'];
                } else {
                        $term = $this->cObj->stdWrap($term, $typeConfigArray['termStdWrap.']);
                        if (strstr($this->conf['modifier'], 'u') !== FALSE) {
-                               $regEx = '/(?<=\P{L}|^)' . preg_quote($term,'/') . '(?=\P{L}|$)/' . $this->conf['modifier'];
+                               $regEx = '/(?<=\P{L}|^)' . preg_quote($term, '/') . '(?=\P{L}|$)/' . $this->conf['modifier'];
                        } else {
-                               $regEx = '/(?<=\W|^)' . preg_quote($term,'/') . '(?=\W|$)/' . $this->conf['modifier'];
+                               $regEx = '/(?<=\W|^)' . preg_quote($term, '/') . '(?=\W|$)/' . $this->conf['modifier'];
                        }
                }
-               preg_match_all($regEx,$content,$matchesArray,PREG_OFFSET_CAPTURE);
+               preg_match_all($regEx, $content, $matchesArray, PREG_OFFSET_CAPTURE);
                $matchesArray = $matchesArray[0]; // only take the full pattern matches of the regEx
 
                // determine the maximum of recurrences of the same term to be tagged
                $maxRecurrences = (!empty($this->conf['maxRecurrences'])) ? min($this->conf['maxRecurrences'], count($matchesArray)) : count($matchesArray);
                $step = $maxRecurrences != 0 ? ceil(count($matchesArray) / $maxRecurrences) : 1;
-               for ($i=0; $i < count($matchesArray); $i = $i + $step) {
+               for ($i = 0; $i < count($matchesArray); $i = $i + $step) {
                        if (!empty($this->conf['maxRecurrencesPerPage'])
-                               && $GLOBALS['contagged']['occurences'][$termKey] > (int)$this->conf['maxRecurrencesPerPage']) {
-                                       break;
+                               && $GLOBALS['contagged']['occurences'][$termKey] > (int)$this->conf['maxRecurrencesPerPage']
+                       ) {
+                               break;
                        }
-                       $preContent = substr($content,0,$matchesArray[$i][1]);
-                       $postContent = substr($content,strlen($matchesArray[$i][0])+$matchesArray[$i][1]);
+                       $preContent = substr($content, 0, $matchesArray[$i][1]);
+                       $postContent = substr($content, strlen($matchesArray[$i][0]) + $matchesArray[$i][1]);
 
                        // Flag: $inTag=true if we are inside a tag < here we are >
                        $inTag = FALSE;
-                       if ( preg_match('/<[^<>]*$/' . $this->conf['modifier'],$preContent)>0 && preg_match('/^[^<>]*>/' . $this->conf['modifier'],$postContent)>0 ) {
+                       if (preg_match('/<[^<>]*$/' . $this->conf['modifier'], $preContent) > 0 && preg_match('/^[^<>]*>/' . $this->conf['modifier'], $postContent) > 0) {
                                $inTag = TRUE;
                        }
                        if (!$inTag) {
                                // support for joined words (with a dashes)
                                $preMatch = '';
                                $postMatch = '';
-                               if ($this->checkLocalGlobal($typeConfigArray,'checkPreAndPostMatches')>0) {
+                               if ($this->checkLocalGlobal($typeConfigArray, 'checkPreAndPostMatches') > 0) {
                                        if (strstr($this->conf['modifier'], 'u') !== FALSE) {
                                                preg_match('/(?<=\P{L})\p{L}*-$/' . $this->conf['modifier'], $preContent, $preMatch);
                                                preg_match('/^-\p{L}*(?=\P{L})/' . $this->conf['modifier'], $postContent, $postMatch);
@@ -184,80 +188,80 @@ class tx_contagged extends tslib_pibase {
                                                preg_match('/^-\w*(?=\W)/' . $this->conf['modifier'], $postContent, $postMatch);
                                        }
                                }
-                               $matchedTerm = $preMatch[0].$matchesArray[$i][0].$postMatch[0];
+                               $matchedTerm = $preMatch[0] . $matchesArray[$i][0] . $postMatch[0];
                                $matchStart = $matchesArray[$i][1] - strlen($preMatch[0]);
                                $matchEnd = $matchStart + strlen($matchedTerm);
-                               
+
                                // check for nested matches
                                $isNested = FALSE;
                                $checkArray = $positionsArray;
                                foreach ($checkArray as $start => $value) {
                                        $length = strlen($value['matchedTerm']);
-                                       $end = $start+$length;
-                                       if ( (($matchStart >= $start) && ($matchStart < $end)) || (($matchEnd > $start) && ($matchEnd <= $end)) ) {
+                                       $end = $start + $length;
+                                       if ((($matchStart >= $start) && ($matchStart < $end)) || (($matchEnd > $start) && ($matchEnd <= $end))) {
                                                $isNested = TRUE;
                                        }
-                               }                               
+                               }
                                if (!$isNested) {
                                        $positionsArray[$matchStart] = array(
                                                'termKey' => $termKey,
                                                'matchedTerm' => $matchedTerm,
                                                'preMatch' => $preMatch[0],
                                                'postMatch' => $postMatch[0]
-                                               );
+                                       );
                                        $GLOBALS['contagged']['occurences'][$termKey]++;
-                               }       
+                               }
                        }
                }
        }
-       
-       function doReplace($content,$positionsArray) {
+
+       function doReplace($content, $positionsArray) {
                $posStart = 0;
                $newContent = '';
-               if($positionsArray){
+               if ($positionsArray) {
                        foreach ($positionsArray as $matchStart => $matchArray) {
                                $matchLength = strlen($matchArray['matchedTerm']);
                                $termKey = $matchArray['termKey'];
                                $replacement = $this->getReplacement($termKey, $matchArray['matchedTerm'], $matchArray['preMatch'], $matchArray['postMatch']);
                                $replacementLength = strlen($replacement);
-                               $newContent = $newContent.substr($content,$posStart,$matchStart-$posStart).$replacement;
+                               $newContent = $newContent . substr($content, $posStart, $matchStart - $posStart) . $replacement;
                                $posStart = $matchStart + $matchLength;
                        }
-                       $newContent = $newContent.substr($content,$posStart);
+                       $newContent = $newContent . substr($content, $posStart);
                } else {
                        $newContent = $content;
                }
-                                       
+
                return $newContent;
        }
 
        /**
-        *      Do something with the matched term (replace, stdWrap, link, tag)
+        *     Do something with the matched term (replace, stdWrap, link, tag)
         *
-        * @param int                   $termKey: the internal "uid" of the term (not related to the database uid)
-        * @param string                $matchedTerm: The matched term including pre and post matches
-        * @return string               The replaced, linked and tagged term
+        * @param int            $termKey: the internal "uid" of the term (not related to the database uid)
+        * @param string         $matchedTerm: The matched term including pre and post matches
+        * @return string         The replaced, linked and tagged term
         * @author Jochen Rau
         */
-       function getReplacement($termKey,$matchedTerm,$preMatch,$postMatch) {
+       function getReplacement($termKey, $matchedTerm, $preMatch, $postMatch) {
                $termArray = $this->termsArray[$termKey];
                $typeConfigArray = $this->typesArray[$termArray['term_type'] . '.'];
                // register the term array
-               $this->registerFields($typeConfigArray,$termKey);
-               
+               $this->registerFields($typeConfigArray, $termKey);
+
                // build the tag enclosing the term
-               if ( !empty($typeConfigArray['tag']) ) {
+               if (!empty($typeConfigArray['tag'])) {
                        // get the attributes
-                       $langAttribute = $this->getLangAttribute($typeConfigArray,$termArray);
-                       $titleAttribute = $this->getTitleAttribute($typeConfigArray,$termArray);
-                       $cssClassAttribute = $this->getCssClassAttribute($typeConfigArray,$termArray);
+                       $langAttribute = $this->getLangAttribute($typeConfigArray, $termArray);
+                       $titleAttribute = $this->getTitleAttribute($typeConfigArray, $termArray);
+                       $cssClassAttribute = $this->getCssClassAttribute($typeConfigArray, $termArray);
                        // concatenate the tag
                        $before = '<' . $typeConfigArray['tag'] . $titleAttribute . $cssClassAttribute . $langAttribute . '>';
                        $after = '</' . $typeConfigArray['tag'] . '>';
                }
 
                // replace matched term
-               if ( $this->checkLocalGlobal($typeConfigArray,'replaceTerm') && $termArray['term_replace'] ) {
+               if ($this->checkLocalGlobal($typeConfigArray, 'replaceTerm') && $termArray['term_replace']) {
                        // if the first letter of the matched term is upper case
                        // make the first letter of the replacing term also upper case
                        // (\p{Lu} stands for "unicode letter uppercase")
@@ -276,31 +280,30 @@ class tx_contagged extends tslib_pibase {
 
                // call stdWrap to handle the matched term via TS BEFORE it is wraped with a-tags
                if ($typeConfigArray['preStdWrap.']) {
-                       $matchedTerm = $this->cObj->stdWrap($matchedTerm,$typeConfigArray['preStdWrap.']);
+                       $matchedTerm = $this->cObj->stdWrap($matchedTerm, $typeConfigArray['preStdWrap.']);
                }
 
-               $matchedTerm = $this->linkMatchedTerm($matchedTerm,$typeConfigArray,$termKey);
+               $matchedTerm = $this->linkMatchedTerm($matchedTerm, $typeConfigArray, $termKey);
 
                // call stdWrap to handle the matched term via TS AFTER it was wrapped with a-tags
                if ($typeConfigArray['postStdWrap.'] or $typeConfigArray['stdWrap.']) {
-                       $matchedTerm = $this->cObj->stdWrap($matchedTerm,$typeConfigArray['postStdWrap.']);
-                       $matchedTerm = $this->cObj->stdWrap($matchedTerm,$typeConfigArray['stdWrap.']); // for compatibility with < v0.0.5
+                       $matchedTerm = $this->cObj->stdWrap($matchedTerm, $typeConfigArray['postStdWrap.']);
+                       $matchedTerm = $this->cObj->stdWrap($matchedTerm, $typeConfigArray['stdWrap.']); // for compatibility with < v0.0.5
                }
 
-               if ( !empty($typeConfigArray['tag']) ) {
+               if (!empty($typeConfigArray['tag'])) {
                        $matchedTerm = $before . $matchedTerm . $after;
                }
-                               
+
                // TODO Edit Icons
                $editIconsConf = array(
                        'styleAttribute' => '',
-                       );
-               $matchedTerm = $this->cObj->editIcons($matchedTerm,'tx_contagged_terms:sys_language_uid,hidden,starttime,endtime,fe_group,term_main,term_alt,term_type,term_lang,term_replace,desc_short,desc_long,image,dam_images,imagecaption,imagealt,imagetitle,related,link,exclude',$editIconsConf,'tx_contagged_terms:'.$termArray['uid'],NULL,'&defVals[tx_contagged_terms][desc_short]=TEST');
-               
+               );
+               $matchedTerm = $this->cObj->editIcons($matchedTerm, 'tx_contagged_terms:sys_language_uid,hidden,starttime,endtime,fe_group,term_main,term_alt,term_type,term_lang,term_replace,desc_short,desc_long,image,dam_images,imagecaption,imagealt,imagetitle,related,link,exclude', $editIconsConf, 'tx_contagged_terms:' . $termArray['uid'], NULL, '&defVals[tx_contagged_terms][desc_short]=TEST');
+
                return $matchedTerm;
        }
 
-
        function updateIndex($termKey, $matchedTerm) {
                $currentRecord = t3lib_div::trimExplode(':', $this->cObj->currentRecord);
                $GLOBALS['T3_VAR']['ext']['contagged']['index'][$GLOBALS['TSFE']->id][$termKey] = array(
@@ -310,33 +313,34 @@ class tx_contagged extends tslib_pibase {
                        'currentRecordSource' => $currentRecord[0],
                        'currentRecordUid' => $currentRecord[1],
                        'currentPid' => $GLOBALS['TSFE']->id
-                       );
+               );
        }
 
        /**
         * Some content tagged by configured tags could be prevented from beeing parsed.
         * This function collects all the tags which should be considered.
         *
-        * @return      string          Comma separated list of tags
+        * @return    string        Comma separated list of tags
         */
        function getTagsToOmitt() {
                $tagArray = array();
 
                // if there are tags to exclude: add them to the list
                if ($this->conf['excludeTags']) {
-                       $tagArray = t3lib_div::trimExplode(',',$this->conf['excludeTags'],1);
+                       $tagArray = t3lib_div::trimExplode(',', $this->conf['excludeTags'], 1);
                }
 
                // if configured: add tags used by the term definitions
-               if ($this->conf['autoExcludeTags']>0) {;
+               if ($this->conf['autoExcludeTags'] > 0) {
+                       ;
                        foreach ($this->conf['types.'] as $key => $type) {
-                               if (!empty($type['tag']) && !in_array($type['tag'],$tagArray)) {
+                               if (!empty($type['tag']) && !in_array($type['tag'], $tagArray)) {
                                        $tagArray[] = $type['tag'];
                                }
                        }
                }
-               
-               $tagList = implode(',',$tagArray);
+
+               $tagList = implode(',', $tagArray);
 
                return $tagList;
        }
@@ -353,18 +357,18 @@ class tx_contagged extends tslib_pibase {
                        'pages', // TABLE ...
                        'uid=' . $GLOBALS['TSFE']->id, // WHERE ...
                        array($this->prefixId . '_keywords' => $termsList)
-                       );
+               );
        }
-       
+
        /**
-        * Register the fields in $GLOBALS['TSFE] to be used in the TS Setup 
+        * Register the fields in $GLOBALS['TSFE] to be used in the TS Setup
         *
-        * @param       array           $typeConfigArray: Configuration array of the term
-        * @param       array           $this->termsArray: Array of terms
-        * @param       int                     $termKey: Internal key of the term
+        * @param    array        $typeConfigArray: Configuration array of the term
+        * @param    array        $this->termsArray: Array of terms
+        * @param    int            $termKey: Internal key of the term
         */
-       function registerFields($typeConfigArray,$termKey) {
-               if ($typeConfigArray['stripBlockTags']>0) {
+       function registerFields($typeConfigArray, $termKey) {
+               if ($typeConfigArray['stripBlockTags'] > 0) {
                        $this->termsArray[$termKey]['desc_short_inline'] = $this->stripBlockTags($this->termsArray[$termKey]['desc_short']);
                        $text = $this->cObj->parseFunc($this->termsArray[$termKey]['desc_long'], array(), '< lib.parseFunc_RTE');
                        $this->termsArray[$termKey]['desc_long_inline'] = $this->stripBlockTags($text);
@@ -374,26 +378,26 @@ class tx_contagged extends tslib_pibase {
 
                // register all fields to be handled by the TS Setup
                foreach ($this->termsArray[$termKey] as $label => $value) {
-                       $GLOBALS['TSFE']->register['contagged_'.$label] = $value;
+                       $GLOBALS['TSFE']->register['contagged_' . $label] = $value;
                }
        }
 
        /**
         * Wrap the matched term in a link tag - as configured
         *
-        * @param string $matchedTerm 
-        * @param string $typeConfigArray 
-        * @param string $this->termsArray 
-        * @param string $termKey 
+        * @param string $matchedTerm
+        * @param string $typeConfigArray
+        * @param string $this->termsArray
+        * @param string $termKey
         * @return void
         * @author Jochen Rau
         */
-       function linkMatchedTerm($matchedTerm,$typeConfigArray,$termKey) {
+       function linkMatchedTerm($matchedTerm, $typeConfigArray, $termKey) {
                $termArray = $this->termsArray[$termKey];
 
                // check conditions if the term should be linked to a list page
-               $makeLink = $this->checkLocalGlobal($typeConfigArray,'linkToListPage');
-               if ( $termArray['exclude']>0 ) {
+               $makeLink = $this->checkLocalGlobal($typeConfigArray, 'linkToListPage');
+               if ($termArray['exclude'] > 0) {
                        $makeLink = false;
                }
                if ($termArray['link']) {
@@ -412,38 +416,38 @@ class tx_contagged extends tslib_pibase {
                                $typolinkConf['additionalParams'] = $termArray['link.']['additionalParams'];
                        } else {
                                if ($typeConfigArray['listPages']) {
-                                       $typolinkConf['parameter'] = array_shift(t3lib_div::trimExplode(',',$typeConfigArray['listPages'],1));
+                                       $typolinkConf['parameter'] = array_shift(t3lib_div::trimExplode(',', $typeConfigArray['listPages'], 1));
                                } else {
-                                       $typolinkConf['parameter'] = array_shift(t3lib_div::trimExplode(',',$this->conf['listPages'],1));
+                                       $typolinkConf['parameter'] = array_shift(t3lib_div::trimExplode(',', $this->conf['listPages'], 1));
                                }
                                $GLOBALS['TSFE']->register['contagged_list_page'] = $typolinkConf['parameter'];
                                $additionalParams['source'] = $termArray['source'];
                                $additionalParams['uid'] = $termArray['uid'];
-                               if ($this->checkLocalGlobal($typeConfigArray,'addBackLink')) {
+                               if ($this->checkLocalGlobal($typeConfigArray, 'addBackLink')) {
                                        $additionalParams['backPid'] = $GLOBALS['TSFE']->id;
                                }
                                $typolinkConf['additionalParams'] = t3lib_div::implodeArrayForUrl('tx_contagged', $additionalParams, '', 1);
                        }
                        $GLOBALS['TSFE']->register['contagged_link_url'] = $this->cObj->typoLink_URL($typolinkConf);
-                       $matchedTerm = $this->cObj->typolink($matchedTerm, $typolinkConf);              
+                       $matchedTerm = $this->cObj->typolink($matchedTerm, $typolinkConf);
                }
-               
+
                return $matchedTerm;
        }
 
        /**
         * Overwrite global settings with settings of the type configuration.
         *
-        * @param string $typeConfigArray 
-        * @param string $attributeName 
+        * @param string $typeConfigArray
+        * @param string $attributeName
         * @return void
         * @author Jochen Rau
         */
-       function checkLocalGlobal($typeConfigArray,$attributeName) {
-               if ( isset($typeConfigArray[$attributeName]) ) {
-                       $addAttribute = ($typeConfigArray[$attributeName]>0) ? true : false;
+       function checkLocalGlobal($typeConfigArray, $attributeName) {
+               if (isset($typeConfigArray[$attributeName])) {
+                       $addAttribute = ($typeConfigArray[$attributeName] > 0) ? true : false;
                } else {
-                       $addAttribute = ($this->conf[$attributeName]>0) ? true : false;
+                       $addAttribute = ($this->conf[$attributeName] > 0) ? true : false;
                }
 
                return $addAttribute;
@@ -452,23 +456,22 @@ class tx_contagged extends tslib_pibase {
        /**
         * If the language of the term is undefined, or the page language is the same as language of the term,
         * then the lang attribute will not be shown.
-        *
         * If the terms language is defined and different from the page language, then the language attribute is added.
         *
-        * @param string $typeConfigArray 
-        * @param string $termArray 
+        * @param string $typeConfigArray
+        * @param string $termArray
         * @return void
         * @author Jochen Rau
         */
-       function getLangAttribute($typeConfigArray,$termArray) {
+       function getLangAttribute($typeConfigArray, $termArray) {
                // get page language
                if ($GLOBALS['TSFE']->config['config']['language']) {
                        $pageLanguage = $GLOBALS['TSFE']->config['config']['language'];
                } else {
-                       $pageLanguage = substr($GLOBALS['TSFE']->config['config']['htmlTag_langKey'],0,2);
+                       $pageLanguage = substr($GLOBALS['TSFE']->config['config']['htmlTag_langKey'], 0, 2);
                }
                // build language attribute if the page language is different from the terms language
-               if ( $this->checkLocalGlobal($typeConfigArray,'addLangAttribute') && !empty($termArray['term_lang']) && ( $pageLanguage!=$termArray['term_lang'] ) ) {
+               if ($this->checkLocalGlobal($typeConfigArray, 'addLangAttribute') && !empty($termArray['term_lang']) && ($pageLanguage != $termArray['term_lang'])) {
                        $langAttribute = ' lang="' . $termArray['term_lang'] . '"';
                        $langAttribute .= ' xml:lang="' . $termArray['term_lang'] . '"';
                }
@@ -479,13 +482,13 @@ class tx_contagged extends tslib_pibase {
        /**
         * Renders the title attribute of the tag.
         *
-        * @param string $typeConfigArray 
-        * @param string $termArray 
+        * @param string $typeConfigArray
+        * @param string $termArray
         * @return void
         * @author Jochen Rau
         */
-       function getTitleAttribute($typeConfigArray,$termArray) {
-               if ($this->checkLocalGlobal($typeConfigArray,'addTitleAttribute') && !empty($termArray['desc_short'])) {
+       function getTitleAttribute($typeConfigArray, $termArray) {
+               if ($this->checkLocalGlobal($typeConfigArray, 'addTitleAttribute') && !empty($termArray['desc_short'])) {
                        $titleAttribute = ' title="' . $termArray['desc_short'] . '"';
                }
 
@@ -495,13 +498,13 @@ class tx_contagged extends tslib_pibase {
        /**
         * Renders the class attribute of the tag.
         *
-        * @param       [type]          $typeConfigArray: ...
-        * @param       [type]          $termArray: ...
-        * @return      [type]          ...
+        * @param    [type]        $typeConfigArray: ...
+        * @param    [type]        $termArray: ...
+        * @return    [type]        ...
         */
-       function getCssClassAttribute($typeConfigArray,$termArray) {
-               if ($this->checkLocalGlobal($typeConfigArray,'addCssClassAttribute')) {
-                       if ( $typeConfigArray['cssClass'] ) {
+       function getCssClassAttribute($typeConfigArray, $termArray) {
+               if ($this->checkLocalGlobal($typeConfigArray, 'addCssClassAttribute')) {
+                       if ($typeConfigArray['cssClass']) {
                                $cssClassAttribute = $this->pi_classParam($typeConfigArray['cssClass']);
                        } else {
                                $cssClassAttribute = $this->pi_classParam($termArray['term_type']);
@@ -514,7 +517,7 @@ class tx_contagged extends tslib_pibase {
        /**
         * Test, if the current page should be skipped
         *
-        * @return      boolean True if the page should be skipped
+        * @return    boolean    True if the page should be skipped
         */
        function isContentToSkip() {
                $result = true; // true, if the page should be skipped
@@ -529,13 +532,15 @@ class tx_contagged extends tslib_pibase {
                // check if the root page is in the rootline of the current page
                $includeRootPagesUids = t3lib_div::trimExplode(',', $this->conf['includeRootPages'], 1);
                foreach ($includeRootPagesUids as $includeRootPageUid) {
-                       if (t3lib_div::inArray((array)$pageUidsInRootline, $includeRootPageUid))
+                       if (t3lib_div::inArray((array)$pageUidsInRootline, $includeRootPageUid)) {
                                $result = false;
+                       }
                }
                $excludeRootPagesUids = t3lib_div::trimExplode(',', $this->conf['excludeRootPages'], 1);
                foreach ($excludeRootPagesUids as $excludeRootPageUid) {
-                       if (t3lib_div::inArray((array)$pageUidsInRootline, $excludeRootPageUid))
+                       if (t3lib_div::inArray((array)$pageUidsInRootline, $excludeRootPageUid)) {
                                $result = true;
+                       }
                }
                if (t3lib_div::inList($this->conf['includePages'], $currentPageUid)) {
                        $result = false;
@@ -543,7 +548,7 @@ class tx_contagged extends tslib_pibase {
                if (t3lib_div::inList($this->conf['excludePages'], $currentPageUid)) {
                        $result = true;
                }
-               if ( $GLOBALS['TSFE']->page['tx_contagged_dont_parse'] == 1) {
+               if ($GLOBALS['TSFE']->page['tx_contagged_dont_parse'] == 1) {
                        $result = true;
                }
                if (!empty($this->cObj)) {
@@ -554,24 +559,24 @@ class tx_contagged extends tslib_pibase {
 
                return $result;
        }
-       
+
        /**
         * Replaces block elements with inline versions (if possible)
-        * 
-        * @param string $text 
+        *
+        * @param string $text
         * @return string The reformatted text
         */
        protected function stripBlockTags($text) {
                $blockElements = 'address|blockquote|center|del|dir|div|dl|fieldset|form|h[1-6]|hr|ins|isindex|menu|noframes|noscript|ol|p|pre|table|ul|center|dir|isindex|menu|noframes';
-           $text = preg_replace('%' . $this->getOpeningTag('li|dd') . '%xs', '&nbsp;&nbsp;*&nbsp;', $text);
-           $text = preg_replace('%' . $this->getClosingTag('li|dt') . '%xs', '<br />', $text);
-           $text = preg_replace('%' . $this->getClosingTag('ol|ul|dl') . '%xs', '', $text);
-           $text = preg_replace('%' . $this->getOpeningTag($blockElements) . '%xs', '', $text);
-           $text = preg_replace('%' . $this->getClosingTag($blockElements) . '%xs', '<br />', $text);
-           $text = preg_replace('%' . $this->getOpeningTag('br') . '{2,2}%xs', '<br />', $text);
-           return $text;
+               $text = preg_replace('%' . $this->getOpeningTag('li|dd') . '%xs', '&nbsp;&nbsp;*&nbsp;', $text);
+               $text = preg_replace('%' . $this->getClosingTag('li|dt') . '%xs', '<br />', $text);
+               $text = preg_replace('%' . $this->getClosingTag('ol|ul|dl') . '%xs', '', $text);
+               $text = preg_replace('%' . $this->getOpeningTag($blockElements) . '%xs', '', $text);
+               $text = preg_replace('%' . $this->getClosingTag($blockElements) . '%xs', '<br />', $text);
+               $text = preg_replace('%' . $this->getOpeningTag('br') . '{2,2}%xs', '<br />', $text);
+               return $text;
        }
-       
+
        /**
         * Returns an opening tag of the allowed elements.
         *
@@ -601,7 +606,7 @@ class tx_contagged extends tslib_pibase {
                                )
                                /?>                                                             # closing the tag with '>' or '/>'
                        )";
-               return $tag;            
+               return $tag;
        }
 
        /**
@@ -633,9 +638,9 @@ class tx_contagged extends tslib_pibase {
                                )
                                >                                                               # closing the tag with '>' or '/>'
                        )";
-               return $tag;            
+               return $tag;
        }
-       
+
        /**
         * Adds the qTip plugin script (jQuery). You can call this function in you TS setup if necessary.
         *
index 9d848d3..080a84f 100755 (executable)
@@ -1,80 +1,80 @@
 <?xml version="1.0" encoding="utf-8"?>
 <cooluri>
-  <urlsuffix>.html</urlsuffix>
-  <removetrailingslash>1</removetrailingslash>
-  <cooluris>1</cooluris>
-  
-  <cache>
-    <usecache>1</usecache>
-    <params2cool>
-      <checkforchangeevery>1</checkforchangeevery>
-    </params2cool>
-    <cool2params>
-      <translateifnotfound>0</translateifnotfound>
-      <oldlinksvalidfor>365</oldlinksvalidfor>
-    </cool2params>
-    <cacheparams>0</cacheparams>
-    
-    <pagenotfound>
-      <status>HTTP/1.0 404 Not Found</status>
-      <behavior type="redirect">/index.php?id=404</behavior>
-    </pagenotfound>
-  </cache>
+       <urlsuffix>.html</urlsuffix>
+       <removetrailingslash>1</removetrailingslash>
+       <cooluris>1</cooluris>
+
+       <cache>
+               <usecache>1</usecache>
+               <params2cool>
+                       <checkforchangeevery>1</checkforchangeevery>
+               </params2cool>
+               <cool2params>
+                       <translateifnotfound>0</translateifnotfound>
+                       <oldlinksvalidfor>365</oldlinksvalidfor>
+               </cool2params>
+               <cacheparams>0</cacheparams>
+
+               <pagenotfound>
+                       <status>HTTP/1.0 404 Not Found</status>
+                       <behavior type="redirect">/index.php?id=404</behavior>
+               </pagenotfound>
+       </cache>
+
+       <pagepath>
+               <title>tx_realurl_pathsegment,alias,nav_title,title,subtitle</title>
+               <saveto>id</saveto>
+               <default>0</default>
+               <userfunc>tx_cooluri->getPageTitle</userfunc>
+               <t3conv>1</t3conv>
+       </pagepath>
+
+       <uriparts>
+               <part>
+                       <parameter>tx_contagged[uid]</parameter>
+                       <lookindb>
+                               <to>SELECT term_main FROM tx_contagged_terms WHERE uid=$1</to>
+                               <translatetoif>
+                                       <match>^[0-9]+$</match>
+                               </translatetoif>
+                               <t3conv>1</t3conv>
+                       </lookindb>
+               </part>
+               <part>
+                       <parameter>tx_contagged[index]</parameter>
+                       <lookindb>
+                               <to>SELECT CONCAT('letter-','$1')</to>
+                               <translatetoif>
+                                       <match>^[0-9]+$</match>
+                               </translatetoif>
+                               <t3conv>1</t3conv>
+                       </lookindb>
+               </part>
+       </uriparts>
+
+       <predefinedparts>
+               <part>
+                       <parameter>cHash</parameter>
+               </part>
+       </predefinedparts>
+
+       <valuemaps>
+               <valuemap>
+                       <parameter>L</parameter>
+                       <value key="">0</value>
+                       <value key="en">1</value>
+               </valuemap>
+               <valuemap>
+                       <parameter>type</parameter>
+                       <value key="rss">5432</value>
+                       <value key="sitemap">6006</value>
+               </valuemap>
+       </valuemaps>
+
+       <paramorder>
+               <param>no_cache</param>
+               <param>L</param>
+               <param>type</param>
+       </paramorder>
 
-  <pagepath>
-    <title>tx_realurl_pathsegment,alias,nav_title,title,subtitle</title>
-    <saveto>id</saveto>
-    <default>0</default>    
-    <userfunc>tx_cooluri->getPageTitle</userfunc>
-    <t3conv>1</t3conv>
-  </pagepath>
-  <uriparts>
-    <part>
-      <parameter>tx_contagged[uid]</parameter>
-      <lookindb>
-        <to>SELECT term_main FROM tx_contagged_terms WHERE uid=$1</to>
-        <translatetoif>
-          <match>^[0-9]+$</match>
-        </translatetoif>
-        <t3conv>1</t3conv>
-      </lookindb>
-    </part>
-    <part>
-      <parameter>tx_contagged[index]</parameter>
-      <lookindb>
-        <to>SELECT CONCAT('letter-','$1')</to>
-        <translatetoif>
-          <match>^[0-9]+$</match>
-        </translatetoif>
-        <t3conv>1</t3conv>
-      </lookindb>
-    </part>
-  </uriparts>
-    
-  <predefinedparts>
-    <part>
-      <parameter>cHash</parameter>
-    </part>
-  </predefinedparts>
-  
-  <valuemaps>
-    <valuemap>
-      <parameter>L</parameter>
-      <value key="">0</value>
-      <value key="en">1</value>
-    </valuemap>
-    <valuemap>
-      <parameter>type</parameter>
-      <value key="rss">5432</value>
-      <value key="sitemap">6006</value>
-    </valuemap>
-  </valuemaps>
-  
-  <paramorder>
-    <param>no_cache</param>
-    <param>L</param>
-    <param>type</param>
-  </paramorder>
-  
 </cooluri>
\ No newline at end of file
index cdac545..4a2eb78 100644 (file)
  * You have to add only the PostVarSet (lines 53 to 72).
  * This setup is based on EXT:aeUrlTool default realurl configuration.
  */
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = array ( 
-    '_DEFAULT' => array (
-        'init' => array (
-             'enableCHashCache' => TRUE,
-             'appendMissingSlash' => 'ifNotFile,redirect',
-             'adminJumpToBackend' => TRUE,
-             'enableUrlDecodeCache' => TRUE,
-             'enableUrlEncodeCache' => TRUE,
-             'emptyUrlReturnValue' => '/',
-        ),
-        'redirects' => array (
-        ),
-        'preVars' => array (
-            0 => array (
-                'GETvar' => 'no_cache',
-                'valueMap' => array (
-                    'nc' => '1',
-                ),
-                'noMatch' => 'bypass'
-            ),
-            1 => array (
-                'GETvar' => 'L',
-                'valueMap' => array (
-                    'de' => '0',
-                    'en' => '1',
-                ),
-                'noMatch' => 'bypass',
-            ),
-            2 => array (
-                'GETvar' => 'lang',
-                'valueMap' => array (
-                    'de' => 'de',
-                    'en' => 'en',
-                ),
-                'noMatch' => 'bypass',
-            ),
-        ),
-        'pagePath' => array (
-            'type' => 'user',
-            'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
-            'spaceCharacter' => '-',
-            'languageGetVar' => 'L',
-            'expireDays' => '7',
-        ),
-        'fixedPostVars' => array (
-        ),
-        'postVarSets' => array (
-            '_DEFAULT' => array (
-               'char' => array (
-                    array (
-                        'GETvar' => 'tx_contagged[index]',
-                    ),                           
-                ),                               
-               'source' => array (
-                    array (
-                          'GETvar' => 'tx_contagged[source]',              
-                    ),                           
-                ),
-                               'term' => array (
-                    array (                      
-                       'GETvar' => 'tx_contagged[uid]',
-                          'lookUpTable' => array (
-                              'table' => 'tx_contagged_terms',
-                              'id_field' => 'uid',
-                              'alias_field' => 'term_main',
-                              'addWhereClause' => ' AND NOT deleted',
-                              'useUniqueCache' => '1',
-                              'useUniqueCache_conf' => array (
-                                  'strtolower' => '1',
-                                  'spaceCharacter' => '-',
-                              ),
-                               ),
-                    ),                           
-                ),                             
-               'searchword' => array (           
-                    array (                      
-                        'GETvar' => 'tx_contagged[sword]',
-                    ),                           
-                ),                               
-               'backTo' => array (            
-                    array (                      
-                        'GETvar' => 'tx_contagged[backPid]',
-                    ),
-                ),
-            ),
-        ),
-        'fileName' => array (
-            'defaultToHTMLsuffixOnPrev' => FALSE,
-            'index' => array (
-                'rss.xml' => array (
-                    'keyValues' => array (
-                        'type' => '100',
-                    ),
-                ),
-                'rss091.xml' => array (
-                    'keyValues' => array (
-                        'type' => '101',
-                    ),
-                ),
-                'rdf.xml' => array (
-                    'keyValues' => array (
-                        'type' => '102',
-                    ),
-                ),
-                'atom.xml' => array (
-                    'keyValues' => array (
-                        'type' => '103',
-                    ),
-                ),
-            ),
-        ),
-    ),
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = array(
+       '_DEFAULT' => array(
+               'init' => array(
+                       'enableCHashCache' => TRUE,
+                       'appendMissingSlash' => 'ifNotFile,redirect',
+                       'adminJumpToBackend' => TRUE,
+                       'enableUrlDecodeCache' => TRUE,
+                       'enableUrlEncodeCache' => TRUE,
+                       'emptyUrlReturnValue' => '/',
+               ),
+               'redirects' => array(
+               ),
+               'preVars' => array(
+                       0 => array(
+                               'GETvar' => 'no_cache',
+                               'valueMap' => array(
+                                       'nc' => '1',
+                               ),
+                               'noMatch' => 'bypass'
+                       ),
+                       1 => array(
+                               'GETvar' => 'L',
+                               'valueMap' => array(
+                                       'de' => '0',
+                                       'en' => '1',
+                               ),
+                               'noMatch' => 'bypass',
+                       ),
+                       2 => array(
+                               'GETvar' => 'lang',
+                               'valueMap' => array(
+                                       'de' => 'de',
+                                       'en' => 'en',
+                               ),
+                               'noMatch' => 'bypass',
+                       ),
+               ),
+               'pagePath' => array(
+                       'type' => 'user',
+                       'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
+                       'spaceCharacter' => '-',
+                       'languageGetVar' => 'L',
+                       'expireDays' => '7',
+               ),
+               'fixedPostVars' => array(
+               ),
+               'postVarSets' => array(
+                       '_DEFAULT' => array(
+                               'char' => array(
+                                       array(
+                                               'GETvar' => 'tx_contagged[index]',
+                                       ),
+                               ),
+                               'source' => array(
+                                       array(
+                                               'GETvar' => 'tx_contagged[source]',
+                                       ),
+                               ),
+                               'term' => array(
+                                       array(
+                                               'GETvar' => 'tx_contagged[uid]',
+                                               'lookUpTable' => array(
+                                                       'table' => 'tx_contagged_terms',
+                                                       'id_field' => 'uid',
+                                                       'alias_field' => 'term_main',
+                                                       'addWhereClause' => ' AND NOT deleted',
+                                                       'useUniqueCache' => '1',
+                                                       'useUniqueCache_conf' => array(
+                                                               'strtolower' => '1',
+                                                               'spaceCharacter' => '-',
+                                                       ),
+                                               ),
+                                       ),
+                               ),
+                               'searchword' => array(
+                                       array(
+                                               'GETvar' => 'tx_contagged[sword]',
+                                       ),
+                               ),
+                               'backTo' => array(
+                                       array(
+                                               'GETvar' => 'tx_contagged[backPid]',
+                                       ),
+                               ),
+                       ),
+               ),
+               'fileName' => array(
+                       'defaultToHTMLsuffixOnPrev' => FALSE,
+                       'index' => array(
+                               'rss.xml' => array(
+                                       'keyValues' => array(
+                                               'type' => '100',
+                                       ),
+                               ),
+                               'rss091.xml' => array(
+                                       'keyValues' => array(
+                                               'type' => '101',
+                                       ),
+                               ),
+                               'rdf.xml' => array(
+                                       'keyValues' => array(
+                                               'type' => '102',
+                                       ),
+                               ),
+                               'atom.xml' => array(
+                                       'keyValues' => array(
+                                               'type' => '103',
+                                       ),
+                               ),
+                       ),
+               ),
+       ),
 
-); 
+);
 ?>
\ No newline at end of file
index ee0d9d1..9c37cf8 100644 (file)
@@ -1,9 +1,11 @@
 <?php
-if (!defined ('TYPO3_MODE'))   die ('Access denied.');
+if (!defined('TYPO3_MODE')) {
+       die ('Access denied.');
+}
 
 t3lib_extMgm::addUserTSConfig('
        options.saveDocNew.tx_contagged_terms=1
 ');
 
-t3lib_extMgm::addPItoST43($_EXTKEY,'pi1/class.tx_contagged_pi1.php','_pi1','list_type',1);
+t3lib_extMgm::addPItoST43($_EXTKEY, 'pi1/class.tx_contagged_pi1.php', '_pi1', 'list_type', 1);
 ?>
\ No newline at end of file
index 463cedc..a4db09c 100644 (file)
@@ -1,64 +1,66 @@
 <?php
-if (!defined ('TYPO3_MODE')) die ('Access denied.');
+if (!defined('TYPO3_MODE')) {
+       die ('Access denied.');
+}
 
 t3lib_extMgm::allowTableOnStandardPages('tx_contagged_terms');
 t3lib_extMgm::addToInsertRecords('tx_contagged_terms');
 
 // add contagged to the "insert plugin" content element
-t3lib_extMgm::addPlugin(array('LLL:EXT:contagged/locallang_db.php:tx_contagged_terms.plugin', $_EXTKEY.'_pi1'),'list_type');
+t3lib_extMgm::addPlugin(array('LLL:EXT:contagged/locallang_db.php:tx_contagged_terms.plugin', $_EXTKEY . '_pi1'), 'list_type');
 
 // initialize static extension templates
-t3lib_extMgm::addStaticFile($_EXTKEY,'static/', 'Content parser');
-t3lib_extMgm::addStaticFile($_EXTKEY,'static/examples/', 'Experimental Setup');
+t3lib_extMgm::addStaticFile($_EXTKEY, 'static/', 'Content parser');
+t3lib_extMgm::addStaticFile($_EXTKEY, 'static/examples/', 'Experimental Setup');
 
-$TCA["tx_contagged_terms"] = array (
-       "ctrl" => array (
-               'title'     => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms',         
-               'label'     => 'term_replace',
+$TCA["tx_contagged_terms"] = array(
+       "ctrl" => array(
+               'title' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms',
+               'label' => 'term_replace',
                'label_alt' => 'term_main, term_alt',
                'label_alt_force' => TRUE,
-               'tstamp'    => 'tstamp',
-               'crdate'    => 'crdate',
+               'tstamp' => 'tstamp',
+               'crdate' => 'crdate',
                'cruser_id' => 'cruser_id',
-               'versioningWS' => TRUE, 
+               'versioningWS' => TRUE,
                'origUid' => 't3_origuid',
-               'languageField'            => 'sys_language_uid',       
-               'transOrigPointerField'    => 'l18n_parent',    
-               'transOrigDiffSourceField' => 'l18n_diffsource',        
-               'sortby' => 'sorting',  
-               'delete' => 'deleted',  
-               'enablecolumns' => array (              
-                       'disabled' => 'hidden', 
-                       'starttime' => 'starttime',     
-                       'endtime' => 'endtime', 
+               'languageField' => 'sys_language_uid',
+               'transOrigPointerField' => 'l18n_parent',
+               'transOrigDiffSourceField' => 'l18n_diffsource',
+               'sortby' => 'sorting',
+               'delete' => 'deleted',
+               'enablecolumns' => array(
+                       'disabled' => 'hidden',
+                       'starttime' => 'starttime',
+                       'endtime' => 'endtime',
                        'fe_group' => 'fe_group',
                ),
                'useColumnsForDefaultValues' => 'term_type',
-               'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php',
-               'iconfile'          => t3lib_extMgm::extRelPath($_EXTKEY).'icon_tx_contagged_terms.gif',
+               'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'tca.php',
+               'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY) . 'icon_tx_contagged_terms.gif',
        ),
-       "feInterface" => array (
+       "feInterface" => array(
                "fe_admin_fieldList" => "sys_language_uid, l18n_parent, l18n_diffsource, hidden, starttime, endtime, fe_group, term_main, term_alt, term_type, term_lang, term_replace, desc_short, desc_long, image, dam_images, imagecaption, imagealt, imagetitle, related, link, exclude",
        )
 );
 
 // Add a field  "exclude this page from parsing" to the table "pages" and "tt_content"
-$tempColumns = Array (
-    "tx_contagged_dont_parse" => Array (
-        "exclude" => 1,
-        "label" => "LLL:EXT:contagged/locallang_db.xml:pages.tx_contagged_dont_parse",
-        "config" => Array (
-            "type" => "check",
-        )
-    ),
+$tempColumns = Array(
+       "tx_contagged_dont_parse" => Array(
+               "exclude" => 1,
+               "label" => "LLL:EXT:contagged/locallang_db.xml:pages.tx_contagged_dont_parse",
+               "config" => Array(
+                       "type" => "check",
+               )
+       ),
 );
 
 t3lib_div::loadTCA("pages");
-t3lib_extMgm::addTCAcolumns("pages",$tempColumns,1);
-t3lib_extMgm::addToAllTCAtypes("pages","tx_contagged_dont_parse;;;;1-1-1");
+t3lib_extMgm::addTCAcolumns("pages", $tempColumns, 1);
+t3lib_extMgm::addToAllTCAtypes("pages", "tx_contagged_dont_parse;;;;1-1-1");
 
 t3lib_div::loadTCA("tt_content");
-t3lib_extMgm::addTCAcolumns("tt_content",$tempColumns,1);
-t3lib_extMgm::addToAllTCAtypes("tt_content","tx_contagged_dont_parse;;;;1-1-1");
+t3lib_extMgm::addTCAcolumns("tt_content", $tempColumns, 1);
+t3lib_extMgm::addToAllTCAtypes("tt_content", "tx_contagged_dont_parse;;;;1-1-1");
 
 ?>
\ No newline at end of file
index 1fdf24b..f1475a8 100644 (file)
@@ -84,7 +84,9 @@
                        <label index="tx_contagged_terms.related">Voir aussi</label>
                        <label index="tx_contagged_terms.link">Lien</label>
                        <label index="tx_contagged_terms.exclude">Ne pas afficher dans le glossaire</label>
-                       <label index="pages.tx_contagged_dont_parse">Ne pas remplacer automatiquement les sigles et abbréviations (du glossaire)</label>
+                       <label index="pages.tx_contagged_dont_parse">Ne pas remplacer automatiquement les sigles et abbréviations
+                               (du glossaire)
+                       </label>
                </languageKey>
        </data>
 </T3locallang>
index f59655b..8eadea0 100644 (file)
@@ -1,35 +1,31 @@
 <?php
 /***************************************************************
-       *  Copyright notice
-       *
-       *  (c) 2007 Jochen Rau <j.rau@web.de>
-       *  All rights reserved
-       *
-       *  This script is part of the TYPO3 project. The TYPO3 project is
-       *  free software; you can redistribute it and/or modify
-       *  it under the terms of the GNU General Public License as published by
-       *  the Free Software Foundation; either version 2 of the License, or
-       *  (at your option) any later version.
-       *
-       *  The GNU General Public License can be found at
-       *  http://www.gnu.org/copyleft/gpl.html.
-       *
-       *  This script is distributed in the hope that it will be useful,
-       *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-       *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-       *  GNU General Public License for more details.
-       *
-       *  This copyright notice MUST APPEAR in all copies of the script!
-       ***************************************************************/
+ *  Copyright notice
+ *  (c) 2007 Jochen Rau <j.rau@web.de>
+ *  All rights reserved
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
 
 /**
  * The model of contagged.
  *
- * @author     Jochen Rau <j.rau@web.de>
- * @package    TYPO3
- * @subpackage tx_contagged_model_mapper
+ * @author    Jochen Rau <j.rau@web.de>
+ * @package    TYPO3
+ * @subpackage    tx_contagged_model_mapper
  */
 class tx_contagged_model_mapper implements t3lib_Singleton {
+
        var $conf; // the TypoScript configuration array
        var $controller;
 
@@ -39,28 +35,27 @@ class tx_contagged_model_mapper implements t3lib_Singleton {
                if (!is_object($this->cObj)) {
                        $this->cObj = t3lib_div::makeInstance('tslib_cObj');
                }
-
        }
 
        /**
         * Build an array of the entries in the specified table
         *
-        * @param       [type]          $result: ...
-        * @param       [type]          $dataSource: ...
-        * @return      An              array with the data of the table
+        * @param    array         $result: An result pointer of the database query
+        * @param    string        $dataSource: The identifier of the data source
+        * @return   array         An array with the data of the table
         */
-       function getDataArray($result,$dataSource) {
+       function getDataArray($result, $dataSource) {
                $dataArray = array();
                $dataSourceConfigArray = $this->conf['dataSources.'][$dataSource . '.'];
 
                // add additional fields configured in the mapping configuration of the data source
                $fieldsToMapArray = array();
                foreach ($dataSourceConfigArray['mapping.'] as $fieldToMap => $value) {
-                               $fieldsToMapArray[] = substr($fieldToMap,0,-1);
+                       $fieldsToMapArray[] = substr($fieldToMap, 0, -1);
                }
                $fieldsToMapfromTS = t3lib_div::trimExplode(',', $this->conf['fieldsToMap'], 1);
                foreach ($fieldsToMapfromTS as $key => $fieldToMap) {
-                       if ( !t3lib_div::inArray($fieldsToMapArray,$fieldToMap) ) {
+                       if (!t3lib_div::inArray($fieldsToMapArray, $fieldToMap)) {
                                $fieldsToMapArray[] = $fieldToMap;
                        }
                }
@@ -73,17 +68,17 @@ class tx_contagged_model_mapper implements t3lib_Singleton {
                        $mappedDataArray = array();
                        $mappedDataArray['term'] = $term;
                        $mappedDataArray['source'] = $dataSource;
-                       foreach ( $fieldsToMapArray as $field) {
-                               $value = $dataSourceConfigArray['mapping.'][$field.'.'];
-                               if ( $value['value'] ) {
+                       foreach ($fieldsToMapArray as $field) {
+                               $value = $dataSourceConfigArray['mapping.'][$field . '.'];
+                               if ($value['value']) {
                                        $mappedDataArray[$field] = $value['value'];
-                               } elseif ( $value['field'] ) {
+                               } elseif ($value['field']) {
                                        $mappedDataArray[$field] = $row[$value['field']];
                                } else {
                                        $mappedDataArray[$field] = NULL;
                                }
-                               if ( $value['stdWrap.'] ) {
-                                       $mappedDataArray[$field] = $this->cObj->stdWrap($mappedDataArray[$field],$value['stdWrap.']);
+                               if ($value['stdWrap.']) {
+                                       $mappedDataArray[$field] = $this->cObj->stdWrap($mappedDataArray[$field], $value['stdWrap.']);
                                }
                                if ($field === 'link') {
                                        $mappedDataArray[$field . '.']['additionalParams'] = $value['additionalParams'];
@@ -91,13 +86,13 @@ class tx_contagged_model_mapper implements t3lib_Singleton {
                                                $mappedDataArray[$field . '.']['additionalParams'] = $this->cObj->stdWrap($mappedDataArray[$field . '.']['additionalParams'], $value['additionalParams.']['stdWrap.']);
                                        }
                                }
-                               $GLOBALS['TSFE']->register['contagged_'.$field] = $mappedDataArray[$field];
+                               $GLOBALS['TSFE']->register['contagged_' . $field] = $mappedDataArray[$field];
                        }
 
                        // post processing
-                       $mappedDataArray['term_alt'] = t3lib_div::trimExplode(chr(10),$row['term_alt'],1);
+                       $mappedDataArray['term_alt'] = t3lib_div::trimExplode(chr(10), $row['term_alt'], 1);
                        // TODO: hook "mappingPostProcessing"
-                       
+
                        if (!empty($dataSourceConfigArray['mapping.']['uid.']['field'])) {
                                $dataArray[$row[$dataSourceConfigArray['mapping.']['uid.']['field']]] = $mappedDataArray;
                        } else {
@@ -107,7 +102,6 @@ class tx_contagged_model_mapper implements t3lib_Singleton {
 
                return $dataArray;
        }
-       
 }
 
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/contagged/model/class.tx_contagged_model_mapper.php']) {
index c668359..1a3c73c 100644 (file)
@@ -1,24 +1,19 @@
 <?php
 /***************************************************************
  *  Copyright notice
- *
  *  (c) 2007 Jochen Rau <j.rau@web.de>
  *  All rights reserved
- *
  *  This script is part of the TYPO3 project. The TYPO3 project is
  *  free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *
  *  The GNU General Public License can be found at
  *  http://www.gnu.org/copyleft/gpl.html.
- *
  *  This script is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 require_once (t3lib_extMgm::extPath('contagged') . 'model/class.tx_contagged_model_mapper.php');
@@ -26,17 +21,22 @@ require_once (t3lib_extMgm::extPath('contagged') . 'model/class.tx_contagged_mod
 /**
  * The model of contagged.
  *
- * @author     Jochen Rau <j.rau@web.de>
- * @package    TYPO3
- * @subpackage tx_contagged_model_terms
+ * @author    Jochen Rau <j.rau@web.de>
+ * @package    TYPO3
+ * @subpackage    tx_contagged_model_terms
  */
 class tx_contagged_model_terms implements t3lib_Singleton {
+
        var $conf; // the TypoScript configuration array
        var $controller;
+
        var $tablesArray = array(); // array of all tables in the database
        var $dataSourceArray = array();
+
        var $terms = array();
+
        var $configuredSources = array();
+
        var $listPagesCache = array();
 
        function __construct($controller) {
@@ -46,7 +46,7 @@ class tx_contagged_model_terms implements t3lib_Singleton {
                        $this->cObj = t3lib_div::makeInstance('tslib_cObj');
                }
 
-               $this->mapper  = t3lib_div::makeInstance('tx_contagged_model_mapper', $this->controller);
+               $this->mapper = t3lib_div::makeInstance('tx_contagged_model_mapper', $this->controller);
 
                // build an array of tables in the database
                $this->tablesArray = $GLOBALS['TYPO3_DB']->admin_get_tables(TYPO3_db);
@@ -60,14 +60,14 @@ class tx_contagged_model_terms implements t3lib_Singleton {
                }
 
                $typesArray = $this->conf['types.'];
-               foreach ($typesArray as $type=>$typeConfigArray) {
+               foreach ($typesArray as $type => $typeConfigArray) {
                        $storagePidsArray = $this->getStoragePidsArray($typeConfigArray);
                        $dataSource = $typeConfigArray['dataSource'] ? $typeConfigArray['dataSource'] : 'default';
                        foreach ($storagePidsArray as $pid) {
                                // if there is an entry for the data source: check for duplicates before adding the pid
                                // otherwise: create a new entry and add the pid
                                if ($this->dataSourceArray[$dataSource]) {
-                                       if ( !in_array($pid,$this->dataSourceArray[$dataSource]) ) {
+                                       if (!in_array($pid, $this->dataSourceArray[$dataSource])) {
                                                $this->dataSourceArray[$dataSource][] = intval($pid);
                                        }
                                } else {
@@ -75,13 +75,12 @@ class tx_contagged_model_terms implements t3lib_Singleton {
                                }
                        }
                }
-
        }
 
        function findAllTerms($additionalWhereClause = '') {
                if (empty($this->terms)) {
-                       foreach ($this->dataSourceArray as $dataSource => $storagePidsArray ) {
-                               $this->terms = array_merge($this->terms, $this->fetchTermsFromSource($dataSource,$storagePidsArray));
+                       foreach ($this->dataSourceArray as $dataSource => $storagePidsArray) {
+                               $this->terms = array_merge($this->terms, $this->fetchTermsFromSource($dataSource, $storagePidsArray));
                        }
                }
                return $this->terms;
@@ -89,12 +88,14 @@ class tx_contagged_model_terms implements t3lib_Singleton {
 
        function findAllTermsToListOnPage($pid = NULL) {
                $terms = $this->findAllTerms(' AND exclude=0');
-               if ($pid === NULL) $pid = $GLOBALS['TSFE']->id;
+               if ($pid === NULL) {
+                       $pid = $GLOBALS['TSFE']->id;
+               }
                $filteredTerms = array();
                foreach ($terms as $key => $term) {
                        $typeConfigurationArray = $this->conf['types.'][$term['term_type'] . '.'];
                        $listPidsArray = $this->getListPidsArray($term['term_type']);
-                       if (($typeConfigurationArray['dontListTerms'] == 0) && (in_array($pid, $listPidsArray) || is_array($GLOBALS['T3_VAR']['ext']['contagged']['index'][$pid][$key])) ) {
+                       if (($typeConfigurationArray['dontListTerms'] == 0) && (in_array($pid, $listPidsArray) || is_array($GLOBALS['T3_VAR']['ext']['contagged']['index'][$pid][$key]))) {
                                $filteredTerms[$key] = $term;
                        }
                }
@@ -109,7 +110,9 @@ class tx_contagged_model_terms implements t3lib_Singleton {
        function findTermByUid($dataSource, $uid) {
                $additionalWhereClause = ' AND uid=' . intval($uid);
                $terms = $this->fetchTermsFromSource($dataSource, $storagePidsArray, $additionalWhereClause);
-               if ($this->conf["fetchRelatedTerms"] == 1) $this->fetchRelatedTerms($terms);
+               if ($this->conf["fetchRelatedTerms"] == 1) {
+                       $this->fetchRelatedTerms($terms);
+               }
                if (is_array($terms) && count($terms) > 0) {
                        return array_shift($terms);
                } else {
@@ -120,19 +123,19 @@ class tx_contagged_model_terms implements t3lib_Singleton {
        /**
         * Build an array of the entries in the tables
         *
-        * @param       [type]          $dataSource: ...
-        * @param       [type]          $storagePids: ...
-        * @return      An              array with the terms an their configuration
+        * @param    string        $dataSource: The identifier of the data source
+        * @param    array         $storagePids: An array of storage page IDs
+        * @return   array         An array with the terms an their configuration
         */
-       function fetchTermsFromSource($dataSource, $storagePidsArray= array(), $additionalWhereClause = '') {
+       function fetchTermsFromSource($dataSource, $storagePidsArray = array(), $additionalWhereClause = '') {
                $dataArray = array();
                $dataSourceConfigArray = $this->conf['dataSources.'][$dataSource . '.'];
                $tableName = $dataSourceConfigArray['sourceName'];
                // check if the table exists in the database
-               if (array_key_exists($tableName, $this->tablesArray) ) {                                
+               if (array_key_exists($tableName, $this->tablesArray)) {
                        // Build WHERE-clause
                        $whereClause = '1=1';
-                       $whereClause .= count($storagePidsArray) > 0 ? ' AND pid IN (' . implode(',',$storagePidsArray) . ')' : '';
+                       $whereClause .= count($storagePidsArray) > 0 ? ' AND pid IN (' . implode(',', $storagePidsArray) . ')' : '';
                        $whereClause .= $dataSourceConfigArray['hasSysLanguageUid'] ? ' AND (sys_language_uid=' . intval($GLOBALS['TSFE']->sys_language_uid) . ' OR sys_language_uid=-1)' : '';
                        $whereClause .= $this->cObj->enableFields($tableName);
                        $whereClause .= $additionalWhereClause;
@@ -144,7 +147,7 @@ class tx_contagged_model_terms implements t3lib_Singleton {
                                $whereClause // WHERE ..
                        );
                        // map the fields
-                       $mappedResult = $this->mapper->getDataArray($result,$dataSource);
+                       $mappedResult = $this->mapper->getDataArray($result, $dataSource);
                }
                if (is_array($mappedResult)) {
                        foreach ($mappedResult as $result) {
@@ -184,42 +187,41 @@ class tx_contagged_model_terms implements t3lib_Singleton {
        /**
         * get the storage pids; cascade: type > dataSource > globalConfig
         *
-        * @param string        $typeConfigArray 
-        * @return array        An array containing the storage PIDs of the type given by
+        * @param string    $typeConfigArray
+        * @return array    An array containing the storage PIDs of the type given by
         * @author Jochen Rau
         */
        function getStoragePidsArray($typeConfigArray) {
                $storagePidsArray = array();
                $dataSource = $typeConfigArray['dataSource'] ? $typeConfigArray['dataSource'] : 'default';
                if (!empty($typeConfigArray['storagePids'])) {
-                       $storagePidsArray = t3lib_div::intExplode(',',$typeConfigArray['storagePids']);
-               } elseif (!empty($this->conf['dataSources.'][$dataSource.'.']['storagePids']) ) {
-                       $storagePidsArray = t3lib_div::intExplode(',',$this->conf['dataSources.'][$dataSource.'.']['storagePids']);
+                       $storagePidsArray = t3lib_div::intExplode(',', $typeConfigArray['storagePids']);
+               } elseif (!empty($this->conf['dataSources.'][$dataSource . '.']['storagePids'])) {
+                       $storagePidsArray = t3lib_div::intExplode(',', $this->conf['dataSources.'][$dataSource . '.']['storagePids']);
                } elseif (!empty($this->conf['storagePids'])) {
-                       $storagePidsArray = t3lib_div::intExplode(',',$this->conf['storagePids']);
+                       $storagePidsArray = t3lib_div::intExplode(',', $this->conf['storagePids']);
                }
                return $storagePidsArray;
        }
 
        /**
-        * get the lsit pids; cascade: type > globalConfig
+        * get the list page IDs; cascade: type > globalConfig
         *
-        * @param string        $typeConfigArray 
-        * @return array        An array containing the list PIDs of the type given by
+        * @param string    $typeConfigArray
+        * @return array    An array containing the list PIDs of the type given by
         * @author Jochen Rau
         */
        function getListPidsArray($termType) {
-               if (!isset($this->listPagesCache[$termType])) {         
+               if (!isset($this->listPagesCache[$termType])) {
                        $listPidsArray = array();
-                       if (!empty($this->conf['types.'][$termArray['term_type'].'.']['listPages'])) {
-                               $this->listPagesCache[$termType] = t3lib_div::intExplode(',',$this->conf['types.'][$termArray['term_type'].'.']['listPages']);
+                       if (!empty($this->conf['types.'][$termArray['term_type'] . '.']['listPages'])) {
+                               $this->listPagesCache[$termType] = t3lib_div::intExplode(',', $this->conf['types.'][$termArray['term_type'] . '.']['listPages']);
                        } elseif (!empty($this->conf['listPages'])) {
-                               $this->listPagesCache[$termType] = t3lib_div::intExplode(',',$this->conf['listPages']);
+                               $this->listPagesCache[$termType] = t3lib_div::intExplode(',', $this->conf['listPages']);
                        }
                }
                return $this->listPagesCache[$termType];
        }
-
 }
 
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/contagged/model/class.tx_contagged_model_terms.php']) {
index f64e385..2f79f29 100644 (file)
@@ -1,26 +1,21 @@
 <?php
 /***************************************************************
-       *  Copyright notice
-       *
-       *  (c) 2007 Jochen Rau <j.rau@web.de>
-       *  All rights reserved
-       *
-       *  This script is part of the TYPO3 project. The TYPO3 project is
-       *  free software; you can redistribute it and/or modify
-       *  it under the terms of the GNU General Public License as published by
-       *  the Free Software Foundation; either version 2 of the License, or
-       *  (at your option) any later version.
-       *
-       *  The GNU General Public License can be found at
-       *  http://www.gnu.org/copyleft/gpl.html.
-       *
-       *  This script is distributed in the hope that it will be useful,
-       *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-       *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-       *  GNU General Public License for more details.
-       *
-       *  This copyright notice MUST APPEAR in all copies of the script!
-       ***************************************************************/
+ *  Copyright notice
+ *  (c) 2007 Jochen Rau <j.rau@web.de>
+ *  All rights reserved
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
 
 require_once (PATH_tslib . 'class.tslib_pibase.php');
 require_once (t3lib_extMgm::extPath('contagged') . 'class.tx_contagged.php');
@@ -30,31 +25,35 @@ require_once (t3lib_extMgm::extPath('contagged') . 'model/class.tx_contagged_mod
 /**
  * contagged list plugin
  *
- * @author     Jochen Rau <j.rau@web.de>
- * @package    TYPO3
- * @subpackage tx_contagged_pi1
+ * @author    Jochen Rau <j.rau@web.de>
+ * @package    TYPO3
+ * @subpackage    tx_contagged_pi1
  */
 class tx_contagged_pi1 extends tslib_pibase {
+
        var $prefixId = 'tx_contagged'; // same as class name
        var $scriptRelPath = 'pi1/class.tx_contagged_pi1.php'; // path to this script relative to the extension dir
        var $extKey = 'contagged'; // the extension key
        var $templateFile = 'EXT:contagged/pi1/contagged.tmpl';
+
        var $conf; // the TypoScript configuration array
        var $templateCode; // template file
        var $local_cObj;
+
        var $typolinkConf;
+
        var $backPid; // pid of the last visited page (from piVars)
        var $indexChar; // char of the given index the user has clicked on (from piVars)
 
        /**
         * main method of the contagged list plugin
         *
-        * @param       string          $content: The content of the cObj
-        * @param       array           $conf: The configuration
-        * @return      string                  a single or list view of terms
+        * @param    string        $content: The content of the cObj
+        * @param    array        $conf: The configuration
+        * @return    string            a single or list view of terms
         */
        function main($content, $conf) {
-               $this->conf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId.'.'];
+               $this->conf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId . '.'];
                $this->parser = t3lib_div::makeInstance('tx_contagged');
                $this->local_cObj = t3lib_div::makeInstance('tslib_cObj');
                $this->local_cObj->setCurrentVal($GLOBALS['TSFE']->id);
@@ -62,7 +61,7 @@ class tx_contagged_pi1 extends tslib_pibase {
                        $this->conf = t3lib_div::array_merge_recursive_overrule($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_contagged.'], $conf);
                }
                $this->pi_loadLL();
-               $this->templateCode = $this->cObj->fileResource($this->conf['templateFile']?$this->conf['templateFile']:$this->templateFile);
+               $this->templateCode = $this->cObj->fileResource($this->conf['templateFile'] ? $this->conf['templateFile'] : $this->templateFile);
                $this->typolinkConf = is_array($this->conf['typolink.']) ? $this->conf['typolink.'] : array();
                $this->typolinkConf['parameter.']['current'] = 1;
                if (!empty($this->typolinkConf['additionalParams'])) {
@@ -77,7 +76,7 @@ class tx_contagged_pi1 extends tslib_pibase {
                        $dataSource = stripslashes($this->piVars['source']);
                        $uid = intval($this->piVars['uid']);
                        $termKey = stripslashes($this->piVars['source']) . '_' . intval($this->piVars['uid']);
-               }               
+               }
                $sword = $this->piVars['sword'] ? htmlspecialchars(urldecode($this->piVars['sword'])) : NULL;
 
                // get an array of all type configurations
@@ -87,27 +86,27 @@ class tx_contagged_pi1 extends tslib_pibase {
                $this->mapper = t3lib_div::makeInstance('tx_contagged_model_mapper', $this);
                $this->model = t3lib_div::makeInstance('tx_contagged_model_terms', $this);
 
-               if ( !is_null($termKey) ) {
+               if (!is_null($termKey)) {
                        $content .= $this->renderSingleItemByKey($dataSource, $uid);
                } elseif ((strtolower($this->conf['layout']) == 'minilist') || (strtolower($this->cObj->data['select_key']) == 'minilist')) {
                        $content .= $this->renderMiniList();
-               } elseif ( is_null($termKey) && is_null($sword) ) {
+               } elseif (is_null($termKey) && is_null($sword)) {
                        $content .= $this->renderList();
-               } elseif ( is_null($termKey) && !is_null($sword) ) {
+               } elseif (is_null($termKey) && !is_null($sword)) {
                        $content .= $this->renderListBySword($sword);
-               } 
+               }
 
                // TODO hook "newRenderFunctionName"
 
                $content = $this->removeUnfilledMarker($content);
-                               
+
                return $this->pi_wrapInBaseClass($content);
        }
 
        /**
         * Renders the list of terms
         *
-        * @return      $string The list as HTML
+        * @return    $string    The list as HTML
         */
        function renderList() {
                $markerArray = array();
@@ -118,22 +117,22 @@ class tx_contagged_pi1 extends tslib_pibase {
                $this->renderIndex($markerArray, $termsArray);
                $this->renderSearchBox($markerArray);
                $indexedTerms = array();
-               foreach ( $termsArray as $termKey => $termArray ) {
-                       if ( $this->indexChar==NULL || $termArray['indexChar']==$this->indexChar ) {
+               foreach ($termsArray as $termKey => $termArray) {
+                       if ($this->indexChar == NULL || $termArray['indexChar'] == $this->indexChar) {
                                $indexedTerms[$termKey] = $termArray;
                        }
                }
-               if ( $this->conf['pagebrowser.']['enable'] > 0 ) {
+               if ($this->conf['pagebrowser.']['enable'] > 0) {
                        $this->renderPageBrowser($markerArray, count($indexedTerms));
                        $terms = array_slice($indexedTerms, ($this->pointer * $this->internal['results_at_a_time']), $this->internal['results_at_a_time'], TRUE);
                } else {
                        $terms = $indexedTerms;
                }
-               foreach ( $terms as $termKey => $termArray ) {
-                       $this->renderSingleItem($termArray,$markerArray,$wrappedSubpartArray);
-                       $subpartArray['###LIST###'] .= $this->cObj->substituteMarkerArrayCached($subparts['item'],$markerArray,$subpartArray,$wrappedSubpartArray);
+               foreach ($terms as $termKey => $termArray) {
+                       $this->renderSingleItem($termArray, $markerArray, $wrappedSubpartArray);
+                       $subpartArray['###LIST###'] .= $this->cObj->substituteMarkerArrayCached($subparts['item'], $markerArray, $subpartArray, $wrappedSubpartArray);
                }
-               $content = $this->cObj->substituteMarkerArrayCached($subparts['template_list'],$markerArray,$subpartArray,$wrappedSubpartArray);
+               $content = $this->cObj->substituteMarkerArrayCached($subparts['template_list'], $markerArray, $subpartArray, $wrappedSubpartArray);
 
                return $content;
        }
@@ -141,16 +140,16 @@ class tx_contagged_pi1 extends tslib_pibase {
        /**
         * Renders the mini list of terms
         *
-        * @return      $string The list as HTML
+        * @return    $string    The list as HTML
         */
        function renderMiniList() {
                $subparts = $this->getSubparts('MINILIST');
                $terms = $this->model->findAllTermsToListOnPage();
-               foreach ( $terms as $termKey => $termArray ) {
-                       $this->renderSingleItem($termArray,$markerArray,$wrappedSubpartArray);
-                       $subpartArray['###LIST###'] .= $this->cObj->substituteMarkerArrayCached($subparts['item'],$markerArray,$subpartArray,$wrappedSubpartArray);
+               foreach ($terms as $termKey => $termArray) {
+                       $this->renderSingleItem($termArray, $markerArray, $wrappedSubpartArray);
+                       $subpartArray['###LIST###'] .= $this->cObj->substituteMarkerArrayCached($subparts['item'], $markerArray, $subpartArray, $wrappedSubpartArray);
                }
-               $content = $this->cObj->substituteMarkerArrayCached($subparts['template_list'],$markerArray,$subpartArray,$wrappedSubpartArray);
+               $content = $this->cObj->substituteMarkerArrayCached($subparts['template_list'], $markerArray, $subpartArray, $wrappedSubpartArray);
 
                return $content;
        }
@@ -161,37 +160,37 @@ class tx_contagged_pi1 extends tslib_pibase {
                $swordMatched = FALSE;
                $subparts = $this->getSubparts('LIST');
                $termsArray = $this->model->findAllTermsToListOnPage();
-               $this->renderLinks($markerArray,$wrappedSubpartArray);
+               $this->renderLinks($markerArray, $wrappedSubpartArray);
                $this->renderIndex($markerArray, $termsArray);
                $this->renderSearchBox($markerArray);
-               foreach ( $termsArray as $termKey => $termArray ) {
-                       $fieldsToSearch = t3lib_div::trimExplode(',', $this->conf['searchbox.']['fieldsToSearch'] );
-                       foreach ($fieldsToSearch as $field) {                                           
+               foreach ($termsArray as $termKey => $termArray) {
+                       $fieldsToSearch = t3lib_div::trimExplode(',', $this->conf['searchbox.']['fieldsToSearch']);
+                       foreach ($fieldsToSearch as $field) {
                                if (is_array($termArray[$field])) {
                                        foreach ($termArray[$field] as $subFieldValue) {
-                                               if (preg_match('/' . preg_quote($sword,'/') . '/Uis', strip_tags($subFieldValue)) > 0) {
+                                               if (preg_match('/' . preg_quote($sword, '/') . '/Uis', strip_tags($subFieldValue)) > 0) {
                                                        $swordMatched = TRUE;
                                                        break;
                                                }
                                        }
                                } else {
-                                       if (preg_match('/' . preg_quote($sword,'/') . '/Uis', strip_tags($termArray[$field])) > 0) {
+                                       if (preg_match('/' . preg_quote($sword, '/') . '/Uis', strip_tags($termArray[$field])) > 0) {
                                                $swordMatched = TRUE;
                                                break;
                                        }
                                }
                        }
-                       if ( $swordMatched ) {
-                               $this->renderSingleItem($termArray,$markerArray,$wrappedSubpartArray);
-                               $subpartArray['###LIST###'] .= $this->cObj->substituteMarkerArrayCached($subparts['item'],$markerArray,$subpartArray,$wrappedSubpartArray);
+                       if ($swordMatched) {
+                               $this->renderSingleItem($termArray, $markerArray, $wrappedSubpartArray);
+                               $subpartArray['###LIST###'] .= $this->cObj->substituteMarkerArrayCached($subparts['item'], $markerArray, $subpartArray, $wrappedSubpartArray);
                                $swordMatched = FALSE;
                        }
                }
                if ($subpartArray['###LIST###'] == '') {
-                       $subpartArray['###LIST###'] = $this->pi_getLL('no_matches');                    
+                       $subpartArray['###LIST###'] = $this->pi_getLL('no_matches');
                }
 
-               $content = $this->cObj->substituteMarkerArrayCached($subparts['template_list'],$markerArray,$subpartArray,$wrappedSubpartArray);                        
+               $content = $this->cObj->substituteMarkerArrayCached($subparts['template_list'], $markerArray, $subpartArray, $wrappedSubpartArray);
 
                return $content;
        }
@@ -201,12 +200,12 @@ class tx_contagged_pi1 extends tslib_pibase {
                $wrappedSubpartArray = array();
                $termArray = $this->model->findTermByUid($dataSource, $uid);
                $subparts = $this->getSubparts('SINGLE');
-               $this->renderLinks($markerArray,$wrappedSubpartArray);
+               $this->renderLinks($markerArray, $wrappedSubpartArray);
                $termsArray = $this->model->findAllTermsToListOnPage();
                $this->renderIndex($markerArray, $termsArray);
-               $this->renderSingleItem($termArray,$markerArray,$wrappedSubpartArray);
-               $subpartArray['###LIST###'] = $this->cObj->substituteMarkerArrayCached($subparts['item'],$markerArray,$subpartArray,$wrappedSubpartArray);
-               $content = $this->cObj->substituteMarkerArrayCached($subparts['template_list'],$markerArray,$subpartArray,$wrappedSubpartArray);
+               $this->renderSingleItem($termArray, $markerArray, $wrappedSubpartArray);
+               $subpartArray['###LIST###'] = $this->cObj->substituteMarkerArrayCached($subparts['item'], $markerArray, $subpartArray, $wrappedSubpartArray);
+               $content = $this->cObj->substituteMarkerArrayCached($subparts['template_list'], $markerArray, $subpartArray, $wrappedSubpartArray);
 
                return $content;
        }
@@ -214,7 +213,7 @@ class tx_contagged_pi1 extends tslib_pibase {
        // TODO hook "newRenderFunction"
 
        function getSubparts($templateName = 'LIST') {
-               $subparts['template_list'] = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE_' . $templateName . '###');
+               $subparts['template_list'] = $this->cObj->getSubpart($this->templateCode, '###TEMPLATE_' . $templateName . '###');
                $subparts['item'] = $this->cObj->getSubpart($subparts['template_list'], '###ITEM###');
 
                return $subparts;
@@ -223,7 +222,7 @@ class tx_contagged_pi1 extends tslib_pibase {
        function renderLinks(&$markerArray, &$wrappedSubpartArray) {
                // make "back to..." link
                if ($this->backPid && $this->conf['addBackLink'] !== '0') {
-                       if($this->conf['addBackLinkDescription']>0) {
+                       if ($this->conf['addBackLinkDescription'] > 0) {
                                $pageSelectObject = new t3lib_pageSelect;
                                $pageSelectObject->init(FALSE);
                                $pageSelectObject->sys_language_uid = $GLOBALS['TSFE']->sys_language_uid;
@@ -240,17 +239,17 @@ class tx_contagged_pi1 extends tslib_pibase {
                }
 
                // make "link to all entries"
-           $markerArray['###INDEX_ALL###'] = $this->pi_linkTP($this->pi_getLL('all'));
+               $markerArray['###INDEX_ALL###'] = $this->pi_linkTP($this->pi_getLL('all'));
 
                // make "to list ..." link
                unset($typolinkConf);
                $markerArray['###TO_LIST###'] = $this->pi_getLL('toList');
                $typolinkConf = $this->typolinkConf;
-               $typolinkConf['parameter.']['wrap'] = "|,".$GLOBALS['TSFE']->type;
-               $wrappedSubpartArray['###LINK_TO_LIST###'] = $this->local_cObj->typolinkWrap($typolinkConf);            
+               $typolinkConf['parameter.']['wrap'] = "|," . $GLOBALS['TSFE']->type;
+               $wrappedSubpartArray['###LINK_TO_LIST###'] = $this->local_cObj->typolinkWrap($typolinkConf);
        }
 
-       function renderSingleItem ($termArray,&$markerArray,&$wrappedSubpartArray) {
+       function renderSingleItem($termArray, &$markerArray, &$wrappedSubpartArray) {
                $typeConfigArray = $this->conf['types.'][$termArray['term_type'] . '.'];
 
                $termArray['desc_long'] = $this->cObj->parseFunc($termArray['desc_long'], array(), '< lib.parseFunc_RTE');
@@ -262,43 +261,43 @@ class tx_contagged_pi1 extends tslib_pibase {
                                $termArray[$fieldName] = $this->parser->parse($termArray[$fieldName], array('excludeTerms' => implode(',', $excludeTerms)));
                        }
                }
-                               
+
                $markerArray['###TERM_TYPE###'] = $typeConfigArray['label'];
                $markerArray['###TERM###'] = $termArray['term'];
                $editIconsConf = array(
                        'styleAttribute' => '',
-                       );
+               );
                $markerArray['###TERM_KEY###'] = $termArray['source'] . '_' . $termArray['uid'];
-               $markerArray['###TERM###'] = $this->cObj->editIcons($termArray['term'],'tx_contagged_terms:term_main,term_alt,term_type,term_lang,term_replace,desc_short,desc_long,image,dam_images,imagecaption,imagealt,imagetitle,related,link,exclude',$editIconsConf,'tx_contagged_terms:'.$termArray['uid']);
+               $markerArray['###TERM###'] = $this->cObj->editIcons($termArray['term'], 'tx_contagged_terms:term_main,term_alt,term_type,term_lang,term_replace,desc_short,desc_long,image,dam_images,imagecaption,imagealt,imagetitle,related,link,exclude', $editIconsConf, 'tx_contagged_terms:' . $termArray['uid']);
                $markerArray['###TERM_MAIN###'] = $termArray['term_main'];
-               $markerArray['###TERM_ALT###'] = $termArray['term_alt']?implode(', ',$termArray['term_alt']):$this->pi_getLL('na');
-               $markerArray['###TERM_REPLACE###'] = $termArray['term_replace']?$termArray['term_replace']:$this->pi_getLL('na');
-               $markerArray['###DESC_SHORT###'] = $termArray['desc_short']?$termArray['desc_short']:$this->pi_getLL('na');
-               $markerArray['###DESC_LONG###'] = $termArray['desc_long']?$termArray['desc_long']:$this->pi_getLL('na');
-               $markerArray['###REFERENCE###'] = $termArray['reference']?$termArray['reference']:$this->pi_getLL('na');
-               $markerArray['###PRONUNCIATION###'] = $termArray['pronunciation']?$termArray['pronunciation']:$this->pi_getLL('na');
+               $markerArray['###TERM_ALT###'] = $termArray['term_alt'] ? implode(', ', $termArray['term_alt']) : $this->pi_getLL('na');
+               $markerArray['###TERM_REPLACE###'] = $termArray['term_replace'] ? $termArray['term_replace'] : $this->pi_getLL('na');
+               $markerArray['###DESC_SHORT###'] = $termArray['desc_short'] ? $termArray['desc_short'] : $this->pi_getLL('na');
+               $markerArray['###DESC_LONG###'] = $termArray['desc_long'] ? $termArray['desc_long'] : $this->pi_getLL('na');
+               $markerArray['###REFERENCE###'] = $termArray['reference'] ? $termArray['reference'] : $this->pi_getLL('na');
+               $markerArray['###PRONUNCIATION###'] = $termArray['pronunciation'] ? $termArray['pronunciation'] : $this->pi_getLL('na');
                $markerArray['###IMAGES###'] = $this->renderImages($termArray);
                $multimediaConfiguration = $this->conf['multimedia.'];
                $multimediaConfiguration['file'] = $termArray['multimedia'];
                $markerArray['###MULTIMEDIA###'] = $this->cObj->cObjGetSingle('MULTIMEDIA', $multimediaConfiguration);
                $markerArray['###RELATED###'] = $this->renderRelated($termArray);
-               $markerArray['###TERM_LANG###'] = $this->pi_getLL('lang.'.$termArray['term_lang'])?$this->pi_getLL('lang.'.$termArray['term_lang']):$this->pi_getLL('na');
+               $markerArray['###TERM_LANG###'] = $this->pi_getLL('lang.' . $termArray['term_lang']) ? $this->pi_getLL('lang.' . $termArray['term_lang']) : $this->pi_getLL('na');
 
                $labelWrap = array();
-               $labelWrap['wrap'] = $typeConfigArray['labelWrap1']?$typeConfigArray['labelWrap1']:$this->conf['labelWrap1'];
-               $markerArray['###TERM_TYPE_LABEL###'] = $markerArray['###TERM_TYPE###']?$this->local_cObj->stdWrap($this->pi_getLL('term_type'),$labelWrap):'';
-               $markerArray['###TERM_LABEL###'] = $this->local_cObj->stdWrap($this->pi_getLL('term'),$labelWrap);
-               $markerArray['###TERM_MAIN_LABEL###'] = $this->local_cObj->stdWrap($this->pi_getLL('term_main'),$labelWrap);
-               $markerArray['###TERM_ALT_LABEL###'] = $markerArray['###TERM_ALT###']?$this->local_cObj->stdWrap($this->pi_getLL('term_alt'),$labelWrap):'';
-               $markerArray['###TERM_REPLACE_LABEL###'] = $markerArray['###TERM_REPLACE###']?$this->local_cObj->stdWrap($this->pi_getLL('term_replace'),$labelWrap):'';
-               $markerArray['###DESC_SHORT_LABEL###'] = $markerArray['###DESC_SHORT###']?$this->local_cObj->stdWrap($this->pi_getLL('desc_short'),$labelWrap):'';
-               $markerArray['###DESC_LONG_LABEL###'] = $markerArray['###DESC_LONG###']?$this->local_cObj->stdWrap($this->pi_getLL('desc_long'),$labelWrap):'';
-               $markerArray['###REFERENCE_LABEL###'] = $markerArray['###REFERENCE###']?$this->local_cObj->stdWrap($this->pi_getLL('reference'),$labelWrap):'';
-               $markerArray['###PRONUNCIATION_LABEL###'] = $markerArray['###PRONUNCIATION###']?$this->local_cObj->stdWrap($this->pi_getLL('pronunciation'),$labelWrap):'';
-               $markerArray['###MULTIMEDIA_LABEL###'] = $markerArray['###MULTIMEDIA###']?$this->local_cObj->stdWrap($this->pi_getLL('multimedia'),$labelWrap):'';
-               $markerArray['###RELATED_LABEL###'] = $markerArray['###RELATED###']?$this->local_cObj->stdWrap($this->pi_getLL('related'),$labelWrap):'';
-               $markerArray['###IMAGES_LABEL###'] = $markerArray['###IMAGES###']?$this->local_cObj->stdWrap($this->pi_getLL('images'),$labelWrap):'';
-               $markerArray['###TERM_LANG_LABEL###'] = $markerArray['###TERM_LANG###']?$this->local_cObj->stdWrap($this->pi_getLL('term_lang'),$labelWrap):'';
+               $labelWrap['wrap'] = $typeConfigArray['labelWrap1'] ? $typeConfigArray['labelWrap1'] : $this->conf['labelWrap1'];
+               $markerArray['###TERM_TYPE_LABEL###'] = $markerArray['###TERM_TYPE###'] ? $this->local_cObj->stdWrap($this->pi_getLL('term_type'), $labelWrap) : '';
+               $markerArray['###TERM_LABEL###'] = $this->local_cObj->stdWrap($this->pi_getLL('term'), $labelWrap);
+               $markerArray['###TERM_MAIN_LABEL###'] = $this->local_cObj->stdWrap($this->pi_getLL('term_main'), $labelWrap);
+               $markerArray['###TERM_ALT_LABEL###'] = $markerArray['###TERM_ALT###'] ? $this->local_cObj->stdWrap($this->pi_getLL('term_alt'), $labelWrap) : '';
+               $markerArray['###TERM_REPLACE_LABEL###'] = $markerArray['###TERM_REPLACE###'] ? $this->local_cObj->stdWrap($this->pi_getLL('term_replace'), $labelWrap) : '';
+               $markerArray['###DESC_SHORT_LABEL###'] = $markerArray['###DESC_SHORT###'] ? $this->local_cObj->stdWrap($this->pi_getLL('desc_short'), $labelWrap) : '';
+               $markerArray['###DESC_LONG_LABEL###'] = $markerArray['###DESC_LONG###'] ? $this->local_cObj->stdWrap($this->pi_getLL('desc_long'), $labelWrap) : '';
+               $markerArray['###REFERENCE_LABEL###'] = $markerArray['###REFERENCE###'] ? $this->local_cObj->stdWrap($this->pi_getLL('reference'), $labelWrap) : '';
+               $markerArray['###PRONUNCIATION_LABEL###'] = $markerArray['###PRONUNCIATION###'] ? $this->local_cObj->stdWrap($this->pi_getLL('pronunciation'), $labelWrap) : '';
+               $markerArray['###MULTIMEDIA_LABEL###'] = $markerArray['###MULTIMEDIA###'] ? $this->local_cObj->stdWrap($this->pi_getLL('multimedia'), $labelWrap) : '';
+               $markerArray['###RELATED_LABEL###'] = $markerArray['###RELATED###'] ? $this->local_cObj->stdWrap($this->pi_getLL('related'), $labelWrap) : '';
+               $markerArray['###IMAGES_LABEL###'] = $markerArray['###IMAGES###'] ? $this->local_cObj->stdWrap($this->pi_getLL('images'), $labelWrap) : '';
+               $markerArray['###TERM_LANG_LABEL###'] = $markerArray['###TERM_LANG###'] ? $this->local_cObj->stdWrap($this->pi_getLL('term_lang'), $labelWrap) : '';
 
                // make "more..." link
                $markerArray['###DETAILS###'] = $this->pi_getLL('details');
@@ -309,10 +308,10 @@ class tx_contagged_pi1 extends tslib_pibase {
                $typolinkConf['additionalParams'] .= '&' . $this->prefixId . '[source]=' . $termArray['source'] . '&' . $this->prefixId . '[uid]=' . $termArray['uid'];
                $typolinkConf['parameter'] = array_shift($this->model->getListPidsArray($termArray['term_type']));
                $this->typolinkConf['parameter.']['current'] = 0;
-               $typolinkConf['parameter.']['wrap'] = "|,".$GLOBALS['TSFE']->type;
+               $typolinkConf['parameter.']['wrap'] = "|," . $GLOBALS['TSFE']->type;
                $wrappedSubpartArray['###LINK_DETAILS###'] = $this->local_cObj->typolinkWrap($typolinkConf);
        }
-       
+
        function renderRelated($term) {
                $relatedCode = '';
                if (is_array($term['related'])) {
@@ -324,7 +323,7 @@ class tx_contagged_pi1 extends tslib_pibase {
                                }
                                $typolinkConf['useCacheHash'] = 1;
                                $typolinkConf['additionalParams'] .= '&' . $this->prefixId . '[source]=' . $termReference['source'] . '&' . $this->prefixId . '[uid]=' . $termReference['uid'];
-                               $typolinkConf['parameter.']['wrap'] = "|,".$GLOBALS['TSFE']->type;
+                               $typolinkConf['parameter.']['wrap'] = "|," . $GLOBALS['TSFE']->type;
                                $relatedCode .= $this->local_cObj->stdWrap($this->local_cObj->typoLink($relatedTerm['term'], $typolinkConf), $this->conf['related.']['single.']['stdWrap.']);
                        }
                        return $this->local_cObj->stdWrap(trim($relatedCode), $this->conf['related.']['stdWrap.']);
@@ -332,7 +331,7 @@ class tx_contagged_pi1 extends tslib_pibase {
                        return NULL;
                }
        }
-       
+
        function renderImages($termArray) {
                $images = array();
                $imagesCaption = array();
@@ -341,18 +340,18 @@ class tx_contagged_pi1 extends tslib_pibase {
                $imagesCode = '';
                $imagesConf = $this->conf['images.']['single.'];
                $extConfArray = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['contagged']);
-               if ( $extConfArray['getImagesFromDAM'] > 0 && t3lib_extMgm::isLoaded('dam') ) {
+               if ($extConfArray['getImagesFromDAM'] > 0 && t3lib_extMgm::isLoaded('dam')) {
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
                                'tx_dam.file_path, tx_dam.file_name, tx_dam.alt_text, tx_dam.caption, tx_dam.title',
                                'tx_dam', 'tx_dam_mm_ref', 'tx_contagged_terms',
                                'AND tx_dam_mm_ref.tablenames = "tx_contagged_terms" AND tx_dam_mm_ref.ident="dam_images" ' .
-                               'AND tx_dam_mm_ref.uid_foreign = "' . $termArray['uid'] . '"', '', 'tx_dam_mm_ref.sorting_foreign ASC'
-                               );
+                                       'AND tx_dam_mm_ref.uid_foreign = "' . $termArray['uid'] . '"', '', 'tx_dam_mm_ref.sorting_foreign ASC'
+                       );
                        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                                $images[] = $row['file_path'] . $row['file_name'];
-                               $imagesCaption[] = str_replace(array(chr(10),chr(13)), ' ', $row['caption'] . ' ');
-                               $imagesAltText[] = str_replace(array(chr(10),chr(13)), ' ', $row['alt_text'] . ' ');
-                               $imagesTitleText[] = str_replace(array(chr(10),chr(13)), ' ', $row['title'] . ' ');
+                               $imagesCaption[] = str_replace(array(chr(10), chr(13)), ' ', $row['caption'] . ' ');
+                               $imagesAltText[] = str_replace(array(chr(10), chr(13)), ' ', $row['alt_text'] . ' ');
+                               $imagesTitleText[] = str_replace(array(chr(10), chr(13)), ' ', $row['title'] . ' ');
                        }
                } else {
                        $images = t3lib_div::trimExplode(',', $termArray['image'], 1);
@@ -365,7 +364,7 @@ class tx_contagged_pi1 extends tslib_pibase {
                        $imagesAltText = t3lib_div::trimExplode(chr(10), $termArray['imagealt']);
                        $imagesTitleText = t3lib_div::trimExplode(chr(10), $termArray['imagetitle']);
                }
-               
+
                if (!empty($images)) {
                        foreach ($images as $key => $image) {
                                $imagesConf['image.']['file'] = $image;
@@ -375,25 +374,24 @@ class tx_contagged_pi1 extends tslib_pibase {
                                $imagesCode .= $this->local_cObj->IMAGE($imagesConf['image.']);
                                $imagesCode .= $caption;
                        }
-                       return $this->local_cObj->stdWrap(trim($imagesCode), $this->conf['images.']['stdWrap.']);                       
+                       return $this->local_cObj->stdWrap(trim($imagesCode), $this->conf['images.']['stdWrap.']);
                } else {
                        return NULL;
                }
-               
        }
 
        function renderIndex(&$markerArray, &$terms) {
                if ($this->conf['index.']['enable'] > 0) {
                        $subparts = array();
-                       $subparts['template_index'] = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE_INDEX###');
-                       $subparts['item'] = $this->cObj->getSubpart($subparts['template_index'],'###ITEM###');
+                       $subparts['template_index'] = $this->cObj->getSubpart($this->templateCode, '###TEMPLATE_INDEX###');
+                       $subparts['item'] = $this->cObj->getSubpart($subparts['template_index'], '###ITEM###');
 
                        $indexArray = $this->getIndexArray($terms);
 
                        // wrap index chars and add a class attribute if there is a selected index char.
                        foreach ($indexArray as $indexChar => $link) {
                                $cssClass = '';
-                               if ($this->piVars['index']==$indexChar) {
+                               if ($this->piVars['index'] == $indexChar) {
                                        $cssClass = " class='tx-contagged-act'";
                                }
                                if ($link) {
@@ -418,27 +416,27 @@ class tx_contagged_pi1 extends tslib_pibase {
                foreach (t3lib_div::trimExplode(',', $this->pi_getLL('indexChars')) as $key => $value) {
                        $subCharArray = t3lib_div::trimExplode('|', $value);
                        $indexArray[$subCharArray[0]] = NULL;
-               foreach($subCharArray as $subChar) {
-                   $reverseIndexArray[$subChar] = $subCharArray[0];
-               }
+                       foreach ($subCharArray as $subChar) {
+                               $reverseIndexArray[$subChar] = $subCharArray[0];
+                       }
                }
 
                // The configuered subchars like Ö will be linked as O (see documentation and file "locallang.xml").
                $typolinkConf = $this->typolinkConf;
                foreach ($terms as $termKey => $termArray) {
-                       if ( $this->conf['types.'][$termArray['term_type'].'.']['dontListTerms']!=1 ) {
+                       if ($this->conf['types.'][$termArray['term_type'] . '.']['dontListTerms'] != 1) {
                                foreach ($reverseIndexArray as $subChar => $indexChar) {
-                                       if ( preg_match('/^'.preg_quote($subChar).'/' . $this->conf['modifier'],$termArray['term'])>0 ) {
+                                       if (preg_match('/^' . preg_quote($subChar) . '/' . $this->conf['modifier'], $termArray['term']) > 0) {
                                                $typolinkConf['additionalParams'] = '&' . $this->prefixId . '[index]=' . $indexChar;
                                                $indexArray[$indexChar] = $this->local_cObj->typolink($indexChar, $typolinkConf);
                                                $terms[$termKey]['indexChar'] = $indexChar;
                                        }
                                }
                                // If the term matches no given index char, crate one if desired and add it to the index
-                               if ( ($terms[$termKey]['indexChar'] == '') && ($this->conf['index.']['autoAddIndexChars'] == 1) ) {                                     
+                               if (($terms[$termKey]['indexChar'] == '') && ($this->conf['index.']['autoAddIndexChars'] == 1)) {
                                        // get the first char of the term (UTF8)
                                        // TODO: Make the RegEx configurable to make ZIP-Codes possible
-                                       preg_match('/^./' . $this->conf['modifier'],$termArray['term'],$match);
+                                       preg_match('/^./' . $this->conf['modifier'], $termArray['term'], $match);
                                        $newIndexChar = $match[0];
                                        $indexArray[$newIndexChar] = NULL;
                                        $typolinkConf['additionalParams'] .= '&' . $this->prefixId . '[index]=' . urlencode($newIndexChar);
@@ -449,11 +447,11 @@ class tx_contagged_pi1 extends tslib_pibase {
                }
 
                // TODO Sorting of the index (UTF8)
-               ksort($indexArray,SORT_LOCALE_STRING);
+               ksort($indexArray, SORT_LOCALE_STRING);
 
                return $indexArray;
        }
-       
+
        function renderPageBrowser(&$markerArray, $resultCount) {
                $this->internal['res_count'] = $resultCount;
                $this->internal['results_at_a_time'] = $this->conf['pagebrowser.']['results_at_a_time'] ? intval($this->conf['pagebrowser.']['results_at_a_time']) : 20;
@@ -470,10 +468,10 @@ class tx_contagged_pi1 extends tslib_pibase {
                        $enableHtmlspecialchars = $this->conf['pagebrowser.']['enableHtmlspecialchars'] === '0' ? FALSE : TRUE;
                        $markerArray['###PAGEBROWSER###'] = $this->pi_list_browseresults($this->conf['pagebrowser.']['showResultCount'], $this->conf['pagebrowser.']['tableParams'], $wrapArray, $pointerName, $enableHtmlspecialchars);
                } else {
-                       $markerArray['###PAGEBROWSER###'] = '';                 
+                       $markerArray['###PAGEBROWSER###'] = '';
                }
        }
-       
+
        function renderSearchBox(&$markerArray) {
                if ($this->conf['searchbox.']['enable'] > 0) {
                        $markerArray['###SEARCHBOX###'] = $this->pi_list_searchBox();
@@ -481,14 +479,12 @@ class tx_contagged_pi1 extends tslib_pibase {
                        $markerArray['###SEARCHBOX###'] = '';
                }
        }
-       
+
        protected function removeUnfilledMarker($content) {
                return preg_replace('/###.*?###/', '', $content);
        }
-       
 }
 
-
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/contagged/pi1/class.tx_contagged_pi1.php']) {
        include_once ($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/contagged/pi1/class.tx_contagged_pi1.php']);
 }
index ab25d04..df57cea 100644 (file)
@@ -8,7 +8,8 @@
        <data type="array">
                <languageKey index="default" type="array">
                        <label index="header">Glossary</label>
-                       <label index="indexChars">0-9|1|2|3|4|5|6|7|8|9|0,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z</label>
+                       <label index="indexChars">0-9|1|2|3|4|5|6|7|8|9|0,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
+                       </label>
                        <!-- <label index="indexChars">0,1,2,3,4,5,6,70,71,72,73,74,75,76,77,78,79,8,9,0</label> -->
                        <label index="na">-</label>
                        <label index="details">more details</label>
@@ -45,7 +46,9 @@
                </languageKey>
                <languageKey index="de" type="array">
                        <label index="header">Glossar</label>
-                       <label index="indexChars">0-9|1|2|3|4|5|6|7|8|9|0,A|Ä|AE,B,C,D,E,F,G,H,I,J,K,L,M,N,O|Ö|OE,P,Q,R,S,T,U|Ü|UE,V,W,X,Y,Z</label>
+                       <label index="indexChars">
+                               0-9|1|2|3|4|5|6|7|8|9|0,A|Ä|AE,B,C,D,E,F,G,H,I,J,K,L,M,N,O|Ö|OE,P,Q,R,S,T,U|Ü|UE,V,W,X,Y,Z
+                       </label>
                        <!-- <label index="indexChars">0,1,2,3,4,5,6,70,71,72,73,74,75,76,77,78,79,8,9,0</label> -->
                        <label index="na">-</label>
                        <label index="details">mehr Details</label>
@@ -89,7 +92,8 @@
                        <label index="pronunciation">Prononciation</label>
                        <label index="details">Plus de détails</label>
                        <label index="header">Glossaire</label>
-                       <label index="indexChars">0-9|1|2|3|4|5|6|7|8|9|0,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z</label>
+                       <label index="indexChars">0-9|1|2|3|4|5|6|7|8|9|0,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
+                       </label>
                        <label index="no_matches">Pas de résultat.</label>
                        <label index="pi_list_searchBox_search">Recherche</label>
                        <label index="multimedia">Media</label>
diff --git a/tca.php b/tca.php
index 6395461..15d2855 100644 (file)
--- a/tca.php
+++ b/tca.php
@@ -1,28 +1,29 @@
 <?php
-if (!defined ('TYPO3_MODE'))   die ('Access denied.');
-
+if (!defined('TYPO3_MODE')) {
+       die ('Access denied.');
+}
 
-$TCA["tx_contagged_terms"] = array (
+$TCA["tx_contagged_terms"] = array(
        "ctrl" => $TCA["tx_contagged_terms"]["ctrl"],
-       "interface" => array (
+       "interface" => array(
                "showRecordFieldList" => "sys_language_uid,l18n_parent,l18n_diffsource,hidden,starttime,endtime,fe_group term_main, term_alt, term_type, term_lang, replacement, desc_short, desc_long, reference, pronunciation, image, dam_images,imagecaption, imagealt, imagetitle, multimedia, related, link, exclude"
        ),
        "feInterface" => $TCA["tx_contagged_terms"]["feInterface"],
-       "columns" => array (
-               't3ver_label' => array (
-                       'label'  => 'LLL:EXT:lang/locallang_general.xml:LGL.versionLabel',
-                       'config' => array (
+       "columns" => array(
+               't3ver_label' => array(
+                       'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.versionLabel',
+                       'config' => array(
                                'type' => 'input',
                                'size' => '30',
-                               'max'  => '30',
+                               'max' => '30',
                        )
                ),
-               'sys_language_uid' => array (
+               'sys_language_uid' => array(
                        'exclude' => 1,
-                       'label'  => 'LLL:EXT:lang/locallang_general.xml:LGL.language',
-                       'config' => array (
-                               'type'                => 'select',
-                               'foreign_table'       => 'sys_language',
+                       'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language',
+                       'config' => array(
+                               'type' => 'select',
+                               'foreign_table' => 'sys_language',
                                'foreign_table_where' => 'ORDER BY sys_language.title',
                                'items' => array(
                                        array('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1),
@@ -30,66 +31,66 @@ $TCA["tx_contagged_terms"] = array (
                                )
                        )
                ),
-               'l18n_parent' => array (
+               'l18n_parent' => array(
                        'displayCond' => 'FIELD:sys_language_uid:>:0',
-                       'exclude'     => 1,
-                       'label'       => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent',
-                       'config'      => array (
-                               'type'  => 'select',
-                               'items' => array (
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent',
+                       'config' => array(
+                               'type' => 'select',
+                               'items' => array(
                                        array('', 0),
                                ),
-                               'foreign_table'       => 'tx_contagged_terms',
+                               'foreign_table' => 'tx_contagged_terms',
                                'foreign_table_where' => 'AND tx_contagged_terms.pid=###CURRENT_PID### AND tx_contagged_terms.sys_language_uid IN (-1,0)',
                        )
                ),
-               'l18n_diffsource' => array (
-                       'config' => array (
+               'l18n_diffsource' => array(
+                       'config' => array(
                                'type' => 'passthrough'
                        )
                ),
-               'hidden' => array (
+               'hidden' => array(
                        'exclude' => 1,
-                       'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
-                       'config'  => array (
-                               'type'    => 'check',
+                       'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
+                       'config' => array(
+                               'type' => 'check',
                                'default' => '0'
                        )
                ),
-               'starttime' => array (
+               'starttime' => array(
                        'exclude' => 1,
-                       'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime',
-                       'config'  => array (
-                               'type'     => 'input',
-                               'size'     => '8',
-                               'max'      => '20',
-                               'eval'     => 'date',
-                               'default'  => '0',
+                       'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => '8',
+                               'max' => '20',
+                               'eval' => 'date',
+                               'default' => '0',
                                'checkbox' => '0'
                        )
                ),
-               'endtime' => array (
+               'endtime' => array(
                        'exclude' => 1,
-                       'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime',
-                       'config'  => array (
-                               'type'     => 'input',
-                               'size'     => '8',
-                               'max'      => '20',
-                               'eval'     => 'date',
+                       'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => '8',
+                               'max' => '20',
+                               'eval' => 'date',
                                'checkbox' => '0',
-                               'default'  => '0',
-                               'range'    => array (
+                               'default' => '0',
+                               'range' => array(
                                        'upper' => mktime(0, 0, 0, 12, 31, 2020),
-                                       'lower' => mktime(0, 0, 0, date('m')-1, date('d'), date('Y'))
+                                       'lower' => mktime(0, 0, 0, date('m') - 1, date('d'), date('Y'))
                                )
                        )
                ),
-               'fe_group' => array (
+               'fe_group' => array(
                        'exclude' => 1,
-                       'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.fe_group',
-                       'config'  => array (
-                               'type'  => 'select',
-                               'items' => array (
+                       'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.fe_group',
+                       'config' => array(
+                               'type' => 'select',
+                               'items' => array(
                                        array('', 0),
                                        array('LLL:EXT:lang/locallang_general.xml:LGL.hide_at_login', -1),
                                        array('LLL:EXT:lang/locallang_general.xml:LGL.any_login', -2),
@@ -98,176 +99,176 @@ $TCA["tx_contagged_terms"] = array (
                                'foreign_table' => 'fe_groups'
                        )
                ),
-                       "term_main" => Array (
-                               "exclude" => 1,
-                               "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_main",
-                               "config" => Array (
-                                       "type" => "input",
-                                       "size" => "30",
-                                       "eval" => "required",
-                               )
-                       ),
-                       "term_alt" => Array (
-                               "exclude" => 1,
-                               "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_alt",
-                               "config" => Array (
-                                       "type" => "text",
-                                       "cols" => "30",
-                                       "rows" => "5",
-                               )
-                       ),
-                       "term_type" => Array (
-                               "exclude" => 1,
-                               "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_type",
-                               "config" => Array (
-                                       "type" => "select",
-                                       "itemsProcFunc" => "user_addTermTypes",
-                                       "size" => 1,
-                                       "maxitems" => 1,
-                                       "disableNoMatchingValueElement" => 1,
-                               )
-                       ),
-                       "term_lang" => Array (
-                               "exclude" => 1,
-                               "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang",
-                               "config" => Array (
-                                       "type" => "select",
-                                       // TODO Make selectable languages configurable.
-                                       "items" => Array (
-                                               Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.0", ""),
-                                               Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.1", "en"),
-                                               Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.2", "fr"),
-                                               Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.3", "de"),
-                                               Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.4", "it"),
-                                               Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.5", "es"),
-                                               Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.6", "un"),
-                                       ),
-                                       "size" => 1,
-                                       "maxitems" => 1,
-                               )
-                       ),
-                       "term_replace" => Array (
-                               "exclude" => 1,
-                               "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_replace",
-                               "config" => Array (
-                                       "type" => "input",
-                                       "size" => "30",
-                               )
-                       ),
-                       "desc_short" => Array (
-                               "exclude" => 1,
-                               "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.desc_short",
-                               "config" => Array (
-                                       "type" => "input",
-                                       "size" => "30",
-                               )
-                       ),
-                       "desc_long" => Array (
-                               "exclude" => 1,
-                               "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.desc_long",
-                               "config" => Array (
-                                       "type" => "text",
-                                       "cols" => "30",
-                                       "rows" => "5",
-                               )
-                       ),
-                       "reference" => Array (
-                               "exclude" => 1,
-                               "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.reference",
-                               "config" => Array (
-                                       "type" => "text",
-                                       "cols" => "30",
-                                       "rows" => "2",
-                               )
-                       ),
-                       "pronunciation" => Array (
-                               "exclude" => 1,
-                               "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.pronunciation",
-                               "config" => Array (
-                                       "type" => "input",
-                                       "size" => "30",
-                               )
-                       ),
-                       'multimedia' => Array (
-                               'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.multimedia',
-                               'config' => Array (
-                                       'type' => 'group',
-                                       'internal_type' => 'file',
-                                       'allowed' => 'swf,swa,dcr,wav,avi,au,mov,asf,mpg,wmv,mp3,mp4,m4v',
-                                       'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'],
-                                       'uploadfolder' => 'uploads/media',
-                                       'size' => '2',
-                                       'maxitems' => '1',
-                                       'minitems' => '0'
-                               )
-                       ),
-                       'related' => Array (
-                               'exclude' => 1,
-                               'l10n_mode' => 'exclude',
-                               'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.related',
-                               'config' => Array (
-                                       'type' => 'group',
-                                       'internal_type' => 'db',
-                                       'allowed' => '*',
-                                       'MM' => 'tx_contagged_related_mm',
-                                       'show_thumbs' => 1,
-                                       'size' => 3,
-                                       'autoSizeMax' => 20,
-                                       'maxitems' => 9999,
-                                       'minitems' => 0,
-                               )
-                       ),
-                       "link" => Array (
-                               "exclude" => 1,
-                               "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.link",
-                               "config" => Array (
-                                       "type"     => "input",
-                                       "size"     => "28",
-                                       "max"      => "255",
-                                       "checkbox" => "",
-                                       "eval"     => "trim",
-                                       "wizards"  => array(
-                                               "_PADDING" => 2,
-                                               "link"     => array(
-                                                       "type"         => "popup",
-                                                       "title"        => "Link",
-                                                       "icon"         => "link_popup.gif",
-                                                       "script"       => "browse_links.php?mode=wizard",
-                                                       "JSopenParams" => "height=300,width=500,status=0,menubar=0,scrollbars=1"
-                                               )
+               "term_main" => Array(
+                       "exclude" => 1,
+                       "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_main",
+                       "config" => Array(
+                               "type" => "input",
+                               "size" => "30",
+                               "eval" => "required",
+                       )
+               ),
+               "term_alt" => Array(
+                       "exclude" => 1,
+                       "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_alt",
+                       "config" => Array(
+                               "type" => "text",
+                               "cols" => "30",
+                               "rows" => "5",
+                       )
+               ),
+               "term_type" => Array(
+                       "exclude" => 1,
+                       "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_type",
+                       "config" => Array(
+                               "type" => "select",
+                               "itemsProcFunc" => "user_addTermTypes",
+                               "size" => 1,
+                               "maxitems" => 1,
+                               "disableNoMatchingValueElement" => 1,
+                       )
+               ),
+               "term_lang" => Array(
+                       "exclude" => 1,
+                       "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang",
+                       "config" => Array(
+                               "type" => "select",
+                               // TODO Make selectable languages configurable.
+                               "items" => Array(
+                                       Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.0", ""),
+                                       Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.1", "en"),
+                                       Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.2", "fr"),
+                                       Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.3", "de"),
+                                       Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.4", "it"),
+                                       Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.5", "es"),
+                                       Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.6", "un"),
+                               ),
+                               "size" => 1,
+                               "maxitems" => 1,
+                       )
+               ),
+               "term_replace" => Array(
+                       "exclude" => 1,
+                       "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_replace",
+                       "config" => Array(
+                               "type" => "input",
+                               "size" => "30",
+                       )
+               ),
+               "desc_short" => Array(
+                       "exclude" => 1,
+                       "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.desc_short",
+                       "config" => Array(
+                               "type" => "input",
+                               "size" => "30",
+                       )
+               ),
+               "desc_long" => Array(
+                       "exclude" => 1,
+                       "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.desc_long",
+                       "config" => Array(
+                               "type" => "text",
+                               "cols" => "30",
+                               "rows" => "5",
+                       )
+               ),
+               "reference" => Array(
+                       "exclude" => 1,
+                       "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.reference",
+                       "config" => Array(
+                               "type" => "text",
+                               "cols" => "30",
+                               "rows" => "2",
+                       )
+               ),
+               "pronunciation" => Array(
+                       "exclude" => 1,
+                       "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.pronunciation",
+                       "config" => Array(
+                               "type" => "input",
+                               "size" => "30",
+                       )
+               ),
+               'multimedia' => Array(
+                       'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.multimedia',
+                       'config' => Array(
+                               'type' => 'group',
+                               'internal_type' => 'file',
+                               'allowed' => 'swf,swa,dcr,wav,avi,au,mov,asf,mpg,wmv,mp3,mp4,m4v',
+                               'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'],
+                               'uploadfolder' => 'uploads/media',
+                               'size' => '2',
+                               'maxitems' => '1',
+                               'minitems' => '0'
+                       )
+               ),
+               'related' => Array(
+                       'exclude' => 1,
+                       'l10n_mode' => 'exclude',
+                       'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.related',
+                       'config' => Array(
+                               'type' => 'group',
+                               'internal_type' => 'db',
+                               'allowed' => '*',
+                               'MM' => 'tx_contagged_related_mm',
+                               'show_thumbs' => 1,
+                               'size' => 3,
+                               'autoSizeMax' => 20,
+                               'maxitems' => 9999,
+                               'minitems' => 0,
+                       )
+               ),
+               "link" => Array(
+                       "exclude" => 1,
+                       "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.link",
+                       "config" => Array(
+                               "type" => "input",
+                               "size" => "28",
+                               "max" => "255",
+                               "checkbox" => "",
+                               "eval" => "trim",
+                               "wizards" => array(
+                                       "_PADDING" => 2,
+                                       "link" => array(
+                                               "type" => "popup",
+                                               "title" => "Link",
+                                               "icon" => "link_popup.gif",
+                                               "script" => "browse_links.php?mode=wizard",
+                                               "JSopenParams" => "height=300,width=500,status=0,menubar=0,scrollbars=1"
                                        )
                                )
-                       ),
-                       "exclude" => Array (
-                               "exclude" => 1,
-                               "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.exclude",
-                               "config" => Array (
-                                       "type" => "check",
-                               )
-                       ),
+                       )
                ),
-               "types" => array (
-                       "0" => array("showitem" => "sys_language_uid;;;;1-1-1, l18n_parent, l18n_diffsource, hidden;;1, term_main, term_alt, term_type, term_lang, term_replace, desc_short, desc_long;;;richtext[*]:rte_transform[mode=ts_css|imgpath=uploads/tx_contagged/rte/], reference, pronunciation, image, dam_images, imagecaption, imagealt, imagetitle, multimedia, related, link, exclude")
+               "exclude" => Array(
+                       "exclude" => 1,
+                       "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.exclude",
+                       "config" => Array(
+                               "type" => "check",
+                       )
                ),
-               "palettes" => array (
-                       "1" => array("showitem" => "starttime, endtime, fe_group"),
-                       "2" => array("showitem" => "")
-               )
-       );
+       ),
+       "types" => array(
+               "0" => array("showitem" => "sys_language_uid;;;;1-1-1, l18n_parent, l18n_diffsource, hidden;;1, term_main, term_alt, term_type, term_lang, term_replace, desc_short, desc_long;;;richtext[*]:rte_transform[mode=ts_css|imgpath=uploads/tx_contagged/rte/], reference, pronunciation, image, dam_images, imagecaption, imagealt, imagetitle, multimedia, related, link, exclude")
+       ),
+       "palettes" => array(
+               "1" => array("showitem" => "starttime, endtime, fe_group"),
+               "2" => array("showitem" => "")
+       )
+);
 
 $extConfArray = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['contagged']);
-if ( $extConfArray['getImagesFromDAM'] > 0 && t3lib_extMgm::isLoaded('dam') ) {
-       $TCA["tx_contagged_terms"]['columns'] = array_merge_recursive($TCA["tx_contagged_terms"]['columns'],array(
-               'dam_images' => txdam_getMediaTCA('image_field', 'dam_images')
+if ($extConfArray['getImagesFromDAM'] > 0 && t3lib_extMgm::isLoaded('dam')) {
+       $TCA["tx_contagged_terms"]['columns'] = array_merge_recursive($TCA["tx_contagged_terms"]['columns'], array(
+                       'dam_images' => txdam_getMediaTCA('image_field', 'dam_images')
                )
        );
 } else {
        $TCA["tx_contagged_terms"]['columns'] = array_merge_recursive($TCA["tx_contagged_terms"]['columns'], array(
-                       'image' => Array (
+                       'image' => Array(
                                'exclude' => 1,
                                'l10n_mode' => $l10n_mode_image,
                                'label' => 'LLL:EXT:lang/locallang_general.php:LGL.images',
-                               'config' => Array (
+                               'config' => Array(
                                        'type' => 'group',
                                        'internal_type' => 'file',
                                        'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
@@ -280,31 +281,31 @@ if ( $extConfArray['getImagesFromDAM'] > 0 && t3lib_extMgm::isLoaded('dam') ) {
                                        'minitems' => '0'
                                )
                        ),
-                       'imagecaption' => Array (
+                       'imagecaption' => Array(
                                'exclude' => 1,
                                'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagecaption',
                                'l10n_mode' => $l10n_mode,
-                               'config' => Array (
+                               'config' => Array(
                                        'type' => 'text',
                                        'cols' => '30',
                                        'rows' => '3'
                                )
                        ),
-                       'imagealt' => Array (
+                       'imagealt' => Array(
                                'exclude' => 1,
                                'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagealt',
                                'l10n_mode' => $l10n_mode,
-                               'config' => Array (
+                               'config' => Array(
                                        'type' => 'text',
                                        'cols' => '20',
                                        'rows' => '3'
                                )
                        ),
-                       'imagetitle' => Array (
+                       'imagetitle' => Array(
                                'exclude' => 1,
                                'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagetitle',
                                'l10n_mode' => $l10n_mode,
-                               'config' => Array (
+                               'config' => Array(
                                        'type' => 'text',
                                        'cols' => '20',
                                        'rows' => '3'
@@ -314,9 +315,9 @@ if ( $extConfArray['getImagesFromDAM'] > 0 && t3lib_extMgm::isLoaded('dam') ) {
        );
 }
 
-require_once (PATH_t3lib.'class.t3lib_page.php');
-require_once (PATH_t3lib.'class.t3lib_tstemplate.php');
-require_once (PATH_t3lib.'class.t3lib_tsparser_ext.php');
-require_once(t3lib_extMgM::extPath('contagged').'tx_contagged_userfunction.php');
+require_once (PATH_t3lib . 'class.t3lib_page.php');
+require_once (PATH_t3lib . 'class.t3lib_tstemplate.php');
+require_once (PATH_t3lib . 'class.t3lib_tsparser_ext.php');
+require_once(t3lib_extMgM::extPath('contagged') . 'tx_contagged_userfunction.php');
 
 ?>
\ No newline at end of file
index 1f2a5fe..22656f1 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function user_addTermTypes(&$params,&$pObj) {
+function user_addTermTypes(&$params, &$pObj) {
        global $BE_USER;
 
        $template = t3lib_div::makeInstance('t3lib_TStemplate');
@@ -22,16 +22,16 @@ function user_addTermTypes(&$params,&$pObj) {
        // make localized labels
        $LOCAL_LANG_ARRAY = array();
        if (!empty($conf['types.'])) {
-               foreach ($conf['types.'] as $typeName => $typeConfigArray ) {
+               foreach ($conf['types.'] as $typeName => $typeConfigArray) {
                        unset($LOCAL_LANG_ARRAY);
-                       if ( !$typeConfigArray['hideSelection']>0 && !$typeConfigArray['dataSource'] ) {
+                       if (!$typeConfigArray['hideSelection'] > 0 && !$typeConfigArray['dataSource']) {
                                if (is_array($typeConfigArray['label.'])) {
                                        foreach ($typeConfigArray['label.'] as $langKey => $labelText) {
                                                $LOCAL_LANG_ARRAY[$langKey]['label'] = $labelText;
                                        }
                                }
                                $LOCAL_LANG_ARRAY['default']['label'] = $typeConfigArray['label'] ? $typeConfigArray['label'] : $typeConfigArray['label.']['default'];
-                               $params['items'][]= array( $GLOBALS['LANG']->getLLL('label',$LOCAL_LANG_ARRAY), substr($typeName,0,-1) );
+                               $params['items'][] = array($GLOBALS['LANG']->getLLL('label', $LOCAL_LANG_ARRAY), substr($typeName, 0, -1));
                        }
                }
        }