[+FEATURE] You can now specify the maximum number of recurrences per page by maxRecur...
authorjocrau <jocrau@735d13b6-9817-0410-8766-e36946ffe9aa>
Sun, 21 Nov 2010 11:13:31 +0000 (11:13 +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@40491 735d13b6-9817-0410-8766-e36946ffe9aa

class.tx_contagged.php
static/constants.txt
static/setup.txt

index 89e7e21..ff4f877 100644 (file)
@@ -158,6 +158,10 @@ class tx_contagged extends tslib_pibase {
                $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) {
+                       if (!empty($this->conf['maxRecurrencesPerPage'])
+                               && $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]);
 
@@ -200,6 +204,7 @@ class tx_contagged extends tslib_pibase {
                                                'preMatch' => $preMatch[0],
                                                'postMatch' => $postMatch[0]
                                                );
+                                       $GLOBALS['contagged']['occurences'][$termKey]++;
                                }       
                        }
                }
index fe7d3f1..5a49768 100644 (file)
@@ -21,6 +21,8 @@ contagged {
        autoExcludeTags = 0
        # cat=contagged (parser)//48; type=int; label=Max. Recurrences: The maximum number of terms to be tagged in a cObject.
        maxRecurrences = 99999
+       # cat=contagged (parser)//49; type=int; label=Max. Recurrences per Page: The maximum number of terms to be tagged on a page.
+       maxRecurrencesPerPage = 99999
        # cat=contagged (parser)/enable/50; type=boolean; label=Check for joined words: Take pre- and/or post-matches of joined words (with dash) into account (see documentation for examples).
        checkPreAndPostMatches = 1
        # cat=contagged (parser)/enable/52; type=boolean; label=Respect case: Respect the case of the first letter. Contagged tries to determine the case of the first letter and sets the replacement to this case if enabled.
index 9f68c47..0fc32a6 100644 (file)
@@ -30,6 +30,7 @@ plugin.tx_contagged {
        addCssClassAttribute = {$contagged.addCssClassAttribute}
        replaceTerm = {$contagged.replaceTerm}
        maxRecurrences = {$contagged.maxRecurrences}
+       maxRecurrencesPerPage = {$contagged.maxRecurrencesPerPage}
        updateKeywords = {$contagged.updateKeywords}
        labelWrap1 = {$contagged.labelWrap1}
        labelWrap2 = {$contagged.labelWrap2}