+v1.6.3 2010-04-23 Jochen Rau <jochen.rau@typoplanet.de>
+
+ [+BUGFIX] Parsed fields in a single view are no longer htmlspecialchared by lib.parseFunc_RTE.
+ [+BUGFIX] Index chars are now linked correctly in a single view.
+ [+FEATURE] Added new option autoExcludeTerms. Set this to avoid parsed terms linking to themselves in a single view (defaults to 1).
+ [~TASK] Changed default templates. An index is now shown on a single view page, too.
+
v1.6.2 2010-03-09 Jochen Rau <jochen.rau@typoplanet.de>
[+BUGFIX] Re-enabled support for non non-UTF-8 sites in main RegEx.
* @param array $conf: The configuration array
* @return string The parsed and tagged content that is displayed on the website
*/
- public function parse($content, $conf = NULL) {
- $this->conf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId.'.'];
+ 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->pi_setPiVarDefaults();
if (!is_object($this->cObj)) {
$this->cObj = t3lib_div::makeInstance('tslib_cObj');
$model = t3lib_div::makeInstance('tx_contagged_model_terms', $this);
$this->termsArray = $model->findAllTerms();
+ $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;
$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;
$sortedTerms[] = array('term' => $term, 'key' => $termKey);
}
}
}
function renderListBySword($sword) {
+ $markerArray = array();
+ $wrappedSubpartArray = array();
$swordMatched = FALSE;
$subparts = $this->getSubparts('LIST');
$termsArray = $this->model->findAllTermsToListOnPage();
}
function renderSingleItemByKey($dataSource, $uid) {
+ $markerArray = array();
+ $wrappedSubpartArray = array();
$termArray = $this->model->findTermByUid($dataSource, $uid);
$subparts = $this->getSubparts('SINGLE');
$this->renderLinks($markerArray,$wrappedSubpartArray);
- $terms = array($termArray);
- $this->renderIndex($markerArray, $terms);
+ $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);
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');
if (!empty($this->conf['fieldsToParse'])) {
$fieldsToParse = t3lib_div::trimExplode(',', $this->conf['fieldsToParse']);
+ $excludeTerms = $termArray['term_alt'];
+ $excludeTerms[] = $termArray['term_main'];
foreach ($fieldsToParse as $fieldName) {
- $termArray[$fieldName] = $this->parser->parse($termArray[$fieldName]);
+ $termArray[$fieldName] = $this->parser->parse($termArray[$fieldName], array('excludeTerms' => implode(',', $excludeTerms)));
}
}
$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']?$this->cObj->parseFunc($termArray['desc_long'], array(), '< lib.parseFunc_RTE'):$this->pi_getLL('na');
+ $markerArray['###DESC_LONG###'] = $termArray['desc_long']?$termArray['desc_long']:$this->pi_getLL('na');
$markerArray['###IMAGES###'] = $this->renderImages($termArray);
$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');
<!-- ###TEMPLATE_SINGLE### begin
This is the template to display a single term
-->
- <div class="tx-contagged-navlink"><!--###LINK_TO_LIST###-->###TO_LIST###<!--###LINK_TO_LIST###--></div>
+ ###INDEX###
<div class="tx-contagged-navlink"><!--###LINK_BACK_TO###-->###BACK_TO###<!--###LINK_BACK_TO###--></div>
<dl class="tx-contagged-single">
<!-- ###ITEM### begin-->
<dd>###TERM_LANG_LABEL######TERM_LANG###</dd>
<!-- ###ITEM### end-->
</dl>
- <div class="tx-contagged-navlink"><!--###LINK_TO_LIST###-->###TO_LIST###<!--###LINK_TO_LIST###--></div>
<div class="tx-contagged-navlink"><!--###LINK_BACK_TO###-->###BACK_TO###<!--###LINK_BACK_TO###--></div>
<!-- ###TEMPLATE_SINGLE### end -->
sortField = term
# cat=contagged (list)//38; type=string; label=Fields to be parsed: Fields to be parsed by contagged again before they are outputted in the list view.
fieldsToParse =
+ # cat=contagged (list)//39; type=boolean; label=Auto-exclude Terms: Set this to avoid parsed terms linking to themselves in a single view.
+ autoExcludeTerms = 1
# cat=contagged (list)//40; type=string; label=Fields to Map: Fields to be mapped.
fieldsToMap = uid,pid,term_main,term_alt,term_type,term_lang,term_replace,desc_short,desc_long,image,imagecaption,imagealt,imagetitle,related,link,exclude
# cat=contagged (list)//50; type=boolean; label=Add Back Link: Add a back link to the refering page. Be aware of caching if you activate this!
sortField = {$contagged.sortField}
fieldsToMap = {$contagged.fieldsToMap}
fieldsToParse = {$contagged.fieldsToParse}
+ autoExcludeTerms = {$contagged.autoExcludeTerms}
addBackLink = {$contagged.addBackLink}
addBackLinkDescription = {$contagged.addBackLinkDescription}