[+FEATURE] It is now possible to add additionalParams to the link via mapping. The...
authorjocrau <jocrau@735d13b6-9817-0410-8766-e36946ffe9aa>
Tue, 9 Mar 2010 08:15:28 +0000 (08:15 +0000)
committerBastian Bringenberg <spam@bastian-bringenberg.de>
Thu, 4 Dec 2014 23:56:08 +0000 (00:56 +0100)
[+BUGFIX] Fixed a problem where spaces and invisible characters are tagged for an empty term.
[+BUGFIX] Added missing initialization of an array before foreach is invoked.

git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/contagged/trunk@30894 735d13b6-9817-0410-8766-e36946ffe9aa

ChangeLog
class.tx_contagged.php
ext_emconf.php
model/class.tx_contagged_model_mapper.php
static/constants.txt
static/examples/setup.txt
static/setup.txt
tca.php

index 697ea1f..2ebca2c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+v1.6.1 2010-03-09 Jochen Rau <jochen.rau@typoplanet.de>
+
+       [+FEATURE] It is now possible to add additionalParams to the link via mapping. The additionalParams are processed by stdWrap again. (link.value = 164 [CR] link.additionalParams.stdWrap.dataWrap = &tx_myext_pi1[id]={register:contagged_theid})       
+       [+BUGFIX] Fixed a problem where spaces and invisible characters are tagged for an empty term.
+       [+BUGFIX] Added missing initialization of an array before foreach is invoked.
+       
 v1.6.0 2010-02-06 Jochen Rau <jochen.rau@typoplanet.de>
 
        [~TASK] Deployed version 1.6.0 to TER. Tagged version 1.6.0.
index 700125e..752b93d 100644 (file)
@@ -103,6 +103,9 @@ class tx_contagged extends tslib_pibase {
                        if (!($intKey%2)) {
                                $positionsArray = array();
                                        foreach ($sortedTerms as $termAndKey) {
+                                               if (empty($termAndKey['term'])) {
+                                                       continue;
+                                               }
                                                $this->getPositions($splittedContent[$intKey],$positionsArray,$termAndKey['term'],$termAndKey['key']);
                                        }
                                ksort($positionsArray);
@@ -384,24 +387,22 @@ class tx_contagged extends tslib_pibase {
                                $typolinkConf = t3lib_div::array_merge_recursive_overrule($typolinkConf, $typeConfigArray['typolink.']);
                        }
                        if ($termArray['link']) {
-                               $parameter = $termArray['link'];
+                               $typolinkConf['parameter'] = $termArray['link'];
+                               $typolinkConf['additionalParams'] = $termArray['link.']['additionalParams'];
                        } else {
                                if ($typeConfigArray['listPages']) {
-                                       $parameter = array_shift(t3lib_div::trimExplode(',',$typeConfigArray['listPages'],1));
+                                       $typolinkConf['parameter'] = array_shift(t3lib_div::trimExplode(',',$typeConfigArray['listPages'],1));
                                } else {
-                                       $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')) {
+                                       $additionalParams['backPid'] = $GLOBALS['TSFE']->id;
+                               }
+                               $typolinkConf['additionalParams'] = t3lib_div::implodeArrayForUrl('tx_contagged', $additionalParams, '', 1);
                        }
-                       $GLOBALS['TSFE']->register['contagged_list_page'] = $parameter;
-                       $additionalParams = array(
-                               'source' => $termArray['source'],
-                               'uid' => $termArray['uid'],
-                               );
-                       if ($this->checkLocalGlobal($typeConfigArray,'addBackLink')) {
-                               $additionalParams['backPid'] = $GLOBALS['TSFE']->id;
-                       }
-                       $typolinkConf['additionalParams'] = t3lib_div::implodeArrayForUrl('tx_contagged', $additionalParams, '', 1);
-                       $typolinkConf['parameter'] = $parameter;
                        $GLOBALS['TSFE']->register['contagged_link_url'] = $this->cObj->typoLink_URL($typolinkConf);
                        $matchedTerm = $this->cObj->typolink($matchedTerm, $typolinkConf);              
                }
index 9724115..ff08647 100644 (file)
@@ -15,7 +15,7 @@ $EM_CONF[$_EXTKEY] = array(
        'description' => 'This extension parses your content to tag, replace and link specific terms. It is useful to auto-generate a glossary - but not only. See \'ChangeLog\' and WiKi (\'http://wiki.typo3.org/index.php/Contagged\').',
        'category' => 'fe',
        'shy' => 0,
-       'version' => '1.6.0',
+       'version' => '1.6.1',
        'dependencies' => '',
        'conflicts' => '',
        'priority' => '',
index 1e2ee12..007f0b1 100644 (file)
@@ -85,9 +85,14 @@ class tx_contagged_model_mapper implements t3lib_Singleton {
                                if ( $value['stdWrap.'] ) {
                                        $mappedDataArray[$field] = $this->cObj->stdWrap($mappedDataArray[$field],$value['stdWrap.']);
                                }
+                               if ($field === 'link' && $value['additionalParams']) {
+                                       $mappedDataArray[$field . '.']['additionalParams'] = $value['additionalParams'];
+                                       if ($value['additionalParams.']['stdWrap.']) {
+                                               $mappedDataArray[$field . '.']['additionalParams'] = $this->cObj->stdWrap($mappedDataArray[$field . '.']['additionalParams'], $value['additionalParams.']['stdWrap.']);
+                                       }
+                               }
                                $GLOBALS['TSFE']->register['contagged_'.$field] = $mappedDataArray[$field];
                        }
-                       // TODO $desc_long = preg_replace('/(\015\012)|(\015)|(\012)/ui','<br />',$row['desc_long']);
 
                        // post processing
                        $mappedDataArray['term_alt'] = t3lib_div::trimExplode(chr(10),$row['term_alt'],1);
@@ -97,7 +102,7 @@ class tx_contagged_model_mapper implements t3lib_Singleton {
                                $dataArray[$row[$dataSourceConfigArray['mapping.']['uid.']['field']]] = $mappedDataArray;
                        } else {
                                $dataArray[] = $mappedDataArray;
-                       }                       
+                       }
                }
 
                return $dataArray;
index e9e38a1..e63a720 100644 (file)
@@ -70,9 +70,9 @@ contagged {
        # cat=contagged (list)//71; type=int; label=Results at a time: Number of results to be displayed on a single page.
        results_at_a_time = 20
        # cat=contagged (list)//72; type=int; label=Number of pages: Number of pages to be displayed in the page browser at once.
-       maxPages = 3            
+       maxPages = 3
        # cat=contagged (list)//73; type=boolean; label=Don't link active page
-       dontLinkActivePage = 1  
+       dontLinkActivePage = 1
        # cat=contagged (list)//74; type=string; label=Page position in the list of pages: This defines were the current page is shown in the list of pages in the Pagebrowser. If this var is an integer it will be interpreted as position in the list of pages. If its value is the keyword "center" the current page will be shown in the middle of the pagelist. As the current implementation of pi_pagebrowser is buggy keep it set to "center".
        pagefloat = center
        # cat=contagged (list)//75; type=boolean; label=Show "First"/"Last": Show link to first and last page.
index 53ffe78..f79aee0 100755 (executable)
@@ -187,7 +187,7 @@ plugin.tx_contagged {
        #               dataSource = categories
        #       }
        #       
-       }
+       }
 
        dataSources {
                
index 3b04de9..8d46106 100644 (file)
@@ -138,7 +138,7 @@ plugin.tx_contagged {
 
                abbrevation {
                        label = Abbrevation
-                       label.de = Abk├╝rzung (Beispiel: u.s.w.)                        
+                       label.de = Abk├╝rzung (Beispiel: u.s.w.)
                        tag = abbr
                }
                                
diff --git a/tca.php b/tca.php
index 8e807a8..124af3d 100644 (file)
--- a/tca.php
+++ b/tca.php
@@ -306,8 +306,10 @@ function user_addTermTypes(&$params,&$pObj) {
                foreach ($conf['types.'] as $typeName => $typeConfigArray ) {
                        unset($LOCAL_LANG_ARRAY);
                        if ( !$typeConfigArray['hideSelection']>0 && !$typeConfigArray['dataSource'] ) {
-                               foreach ($typeConfigArray['label.'] as $langKey => $labelText) {
-                                       $LOCAL_LANG_ARRAY[$langKey]['label'] = $labelText;
+                               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) );