* Added a hook for processing external links made through typolink and makelinks.
authorKasper Skårhøj <kasper@typo3.org>
Sat, 31 Jan 2009 13:23:57 +0000 (13:23 +0000)
committerKasper Skårhøj <kasper@typo3.org>
Sat, 31 Jan 2009 13:23:57 +0000 (13:23 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@4902 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/cms/tslib/class.tslib_content.php

index 35d865e..5128186 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2009-01-31     Kasper Sk\8crh¿j  <kasper@typo3.org>
 
+       * Added a hook for processing external links made through typolink and makelinks.
+
+2009-01-31     Kasper Sk\8crh¿j  <kasper@typo3.org>
+
        * Added backend locking feature so the existence of the file typo3conf/LOCK_BACKEND will lock down the backend for browser access. For CLI-script processing.
 
 2009-01-31     Kasper Sk\8crh¿j  <kasper@typo3.org>
index f8bffaa..9267e9b 100755 (executable)
@@ -2962,6 +2962,26 @@ class tslib_cObj {
                return $aTagParams;
         }
 
+       /**
+        * Áll extension links should ask this function for additional properties to their tags. 
+        * Designed to add for instance an "onclick" property for site tracking systems.
+        *
+        * @param       string  URL of the website
+        * @return  string      the additional tag properties
+        */
+       function extLinkATagParams($URL)        {
+               $out = '';
+
+               if ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['extLinkATagParamsHandler']) {
+                       $extLinkATagParamsHandler = &t3lib_div::getUserObj($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['extLinkATagParamsHandler']);
+
+                       if(method_exists($extLinkATagParamsHandler, 'main')) {
+                               $out.= trim($extLinkATagParamsHandler->main($URL, $this));
+                       }
+               }
+               
+               return trim($out) ? ' '.trim($out) : '' ;
+       }
 
 
 
@@ -4690,12 +4710,14 @@ class tslib_cObj {
                                                        ' href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode('http://'.$parts[0]).$GLOBALS['TSFE']->getMethodUrlIdToken).'"'.
                                                        ($target ? ' target="'.$target.'"' : '').
                                                        $aTagParams.
+                                                       $this->extLinkATagParams('http://'.$parts[0]).
                                                        '>';
                                } else {
                                        $res = '<a'.
                                                        ' href="http://'.htmlspecialchars($parts[0]).'"'.
                                                        ($target ? ' target="'.$target.'"' : '').
                                                        $aTagParams.
+                                                       $this->extLinkATagParams('http://'.$parts[0]).
                                                        '>';
                                }
                                if ($conf['ATagBeforeWrap'])    {
@@ -5367,6 +5389,7 @@ class tslib_cObj {
                                        $finalTagParts['url']=$this->lastTypoLinkUrl;
                                        $finalTagParts['targetParams'] = $target ? ' target="'.$target.'"' : '';
                                        $finalTagParts['TYPE']='url';
+                                       $finalTagParts['aTagParams'].=$this->extLinkATagParams($finalTagParts['url']);
                                } elseif ($containsSlash || $isLocalFile)       {       // file (internal)
                                        $splitLinkParam = explode('?', $link_param);
                                        if (file_exists(rawurldecode($splitLinkParam[0])) || $isLocalFile)      {