hooks4typolinkpatch_4.5.x-4.6.x.patch

AOE GmbH, 2011-12-22 17:37

Download (10.9 KB)

View differences:

t3lib/class.t3lib_parsehtml_proc.php (Arbeitskopie)
619 619
					unset($attribArray_copy['style']);
620 620
					unset($attribArray_copy['rteerror']);
621 621
				}
622
				
623
					// remove additional params
624
				if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['removeParams_PostProc']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['removeParams_PostProc'])) {
625
					$_params = array(
626
						'conf' => &$conf,
627
						'aTagParams' => &$attribArray_copy
628
					);
629
					foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['removeParams_PostProc'] as $objRef) {
630
						$processor = &t3lib_div::getUserObj($objRef);
631
						$attribArray_copy = $processor->removeParams( $_params, $this);
632
					}
633
				}
634
				
622 635
				if (!count($attribArray_copy)) { // Only if href, target and class are the only attributes, we can alter the link!
623 636
						// Quoting class and title attributes if they contain spaces
624 637
					$attribArray['class'] = preg_match('/ /', $attribArray['class']) ? '"' . $attribArray['class'] . '"' : $attribArray['class'];
......
628 641
					$href = $attribArray['external'] ? $attribArray['href'] : $info['url'] . ($info['query'] ? ',0,' . $info['query'] : '');
629 642
					$bTag = '<link ' . $href . ($attribArray['target'] ? ' ' . $attribArray['target'] : (($attribArray['class'] || $attribArray['title']) ? ' -' : '')) . ($attribArray['class'] ? ' ' . $attribArray['class'] : ($attribArray['title'] ? ' -' : '')) . ($attribArray['title'] ? ' ' . $attribArray['title'] : '') . '>';
630 643
					$eTag = '</link>';
631
					$blockSplit[$k] = $bTag . $this->TS_links_db($this->removeFirstAndLastTag($blockSplit[$k])) . $eTag;
644
					
645
						// modify params
646
					if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['modifyParams_LinksDb_PostProc']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['modifyParams_LinksDb_PostProc'])) {
647
						$_params = array(
648
							'conf' => &$conf,
649
							'currentBlock' => $v,
650
							'url' => $href,
651
							'attributes' => $attribArray
652
						);
653
						foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['modifyParams_LinksDb_PostProc'] as $objRef) {
654
							$processor = &t3lib_div::getUserObj($objRef);
655
							$blockSplit[$k] = $processor->modifyParamsLinksDb( $_params, $this);
656
						}
657
					} else {					
658
						$blockSplit[$k] = $bTag . $this->TS_links_db($this->removeFirstAndLastTag($blockSplit[$k])) . $eTag;
659
					}
632 660
				} else { // ... otherwise store the link as a-tag.
633 661
						// Unsetting 'rtekeep' attribute if that had been set.
634 662
					unset($attribArray['rtekeep']);
......
665 693
		$siteUrl = $this->siteUrl();
666 694
		foreach ($blockSplit as $k => $v) {
667 695
			$error = '';
668
			$external = FALSE;
669 696
			if ($k % 2) { // block:
670 697
				$tagCode = t3lib_div::unQuoteFilenames(trim(substr($this->getFirstTag($v), 0, -1)), true);
671 698
				$link_param = $tagCode[1];
......
678 705
				} else {
679 706
					$fileChar = intval(strpos($link_param, '/'));
680 707
					$urlChar = intval(strpos($link_param, '.'));
708
					$external = FALSE;
681 709
						// Parse URL:
682 710
					$pU = parse_url($link_param);
683 711
						// Detects if a file is found in site-root OR is a simulateStaticDocument.
......
732 760
						($error ? ' rteerror="' . htmlspecialchars($error) . '" style="background-color: yellow; border:2px red solid; color: black;"' : '') . // Should be OK to add the style; the transformation back to databsae will remove it...
733 761
						'>';
734 762
				$eTag = '</a>';
735
				$blockSplit[$k] = $bTag . $this->TS_links_rte($this->removeFirstAndLastTag($blockSplit[$k])) . $eTag;
763
				
764
					// modify params
765
				if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['modifyParams_LinksRte_PostProc']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['modifyParams_LinksRte_PostProc'])) {
766
					$_params = array(
767
						'conf' => &$conf,
768
						'currentBlock' => $v,
769
						'url' => $href,
770
						'tagCode' => $tagCode,
771
						'external' => $external,
772
						'error'	=> $error
773
					);
774
					foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['modifyParams_LinksRte_PostProc'] as $objRef) {
775
						$processor = &t3lib_div::getUserObj($objRef);
776
						$blockSplit[$k] = $processor->modifyParamsLinksRte( $_params, $this);
777
					}
778
				} else {					
779
					$blockSplit[$k] = $bTag . $this->TS_links_rte($this->removeFirstAndLastTag($blockSplit[$k])) . $eTag;
780
				}
736 781
			}
737 782
		}
738 783

  
typo3/class.browse_links.php (Arbeitskopie)
828 828
				'title'  => $currentLinkParts[3],
829 829
				'params'  => $currentLinkParts[4]
830 830
			);
831
			
831 832
			$this->curUrlArray = (is_array(t3lib_div::_GP('curUrl'))) ?
832 833
				array_merge($initialCurUrlArray, t3lib_div::_GP('curUrl')) :
833 834
				$initialCurUrlArray;
835
			
836
				// additional fields for page links
837
			if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['extendUrlArray']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['extendUrlArray'])) {
838
				$_params = array(
839
					'conf' => &$conf,
840
					'linkParts' => $currentLinkParts
841
				);
842
				foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['extendUrlArray'] as $objRef) {
843
					$processor = &t3lib_div::getUserObj($objRef);
844
					$processor->extendUrlArray( $_params, $this);
845
				}
846
			}
847
			
848
			
834 849
			$this->curUrlInfo = $this->parseCurUrl($this->siteURL.'?id='.$this->curUrlArray['href'], $this->siteURL);
835 850
			if ($this->curUrlInfo['pageid'] == 0 && $this->curUrlArray['href']) { // pageid == 0 means that this is not an internal (page) link
836 851
				if (file_exists(PATH_site.rawurldecode($this->curUrlArray['href'])))	{ // check if this is a link to a file
......
1163 1192
				BrowseLinks.focusOpenerAndClose(close);
1164 1193
			}
1165 1194
		';
1195
		
1196
			// extends JavaScript code
1197
		if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['extendJScode']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['extendJScode'])) {
1198
			$_params = array(
1199
				'conf' => &$conf,
1200
				'wizardUpdate' => $update,
1201
				'addPassOnParams' => $addPassOnParams
1202
			);
1203
			foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['extendJScode'] as $objRef) {
1204
				$processor = &t3lib_div::getUserObj($objRef);
1205
				$JScode .= $processor->extendJScode( $_params, $this);
1206
			}
1207
		}	
1166 1208

  
1167 1209
			// Finally, add the accumulated JavaScript to the template object:
1168 1210
		$this->doc->JScode.= $this->doc->wrapScriptTags($JScode);
1169 1211

  
1212
		
1170 1213
			// Debugging:
1171 1214
		if (FALSE) debug(array(
1172 1215
			'pointer' => $this->pointer,
......
1527 1570
				</form>
1528 1571
';
1529 1572

  
1573
			// additional fields for page links
1574
		if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['addFields_PageLink']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['addFields_PageLink'])) {
1575
			$_params = array(
1576
				'conf' => &$conf,
1577
			);
1578
			foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['addFields_PageLink'] as $objRef) {
1579
				$processor = &t3lib_div::getUserObj($objRef);
1580
				$content .= $processor->addFields( $_params, $this);
1581
			}
1582
		}
1583

  
1584

  
1530 1585
			// Target:
1531 1586
		if ($this->act!='mail')	{
1532 1587
			$ltarget='
typo3/sysext/cms/tslib/class.tslib_content.php (Arbeitskopie)
1654 1654
		if ($addGlobal) {
1655 1655
			$aTagParams = ' ' . trim($GLOBALS['TSFE']->ATagParams . $aTagParams);
1656 1656
		}
1657
		
1658
			// extend params
1659
		if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getATagParams_PostProc']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getATagParams_PostProc'])) {
1660
			$_params = array(
1661
				'conf' => &$conf,
1662
				'aTagParams' => &$aTagParams
1663
			);
1664
			foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getATagParams_PostProc'] as $objRef) {
1665
				$processor = &t3lib_div::getUserObj($objRef);
1666
				$aTagParams = $processor->process( $_params, $this);
1667
			}
1668
		}
1669
		
1657 1670
		return $aTagParams;
1658 1671
	}
1659 1672

  
typo3/sysext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php (Arbeitskopie)
585 585
				}
586 586
			}
587 587
		';
588
		
589
			// Hook to overwrite or extend javascript functions 
590
		if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php']['extendJScode']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php']['extendJScode'])) {
591
        	$_params = array(
592
            	'conf' => &$conf
593
            );
594
            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php']['extendJScode'] as $objRef) {
595
            	$processor = &t3lib_div::getUserObj($objRef);
596
                $JScode .= $processor->extendJScode( $_params, &$this);
597
           	}
598
      	}
599
		
588 600
		return $JScode;
589 601
	}
590 602

  
......
878 890
		$lclass = $this->addClassSelector();
879 891
		$ltitle = $this->addTitleSelector();
880 892
		$rel = $this->addRelField();
893
		
894
			// additional fields for page links
895
		if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php']['addAttributeFields']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php']['addAttributeFields'])) {
896
			$_params = array(
897
				'conf' => &$conf
898
			);
899
			foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php']['addAttributeFields'] as $objRef) {
900
				$processor = &t3lib_div::getUserObj($objRef);
901
				$additionalAttributeFields .= $processor->getAttributefields( $_params, $this);
902
			}
903
		}
904
		
881 905
		if ($lpageId || $queryParameters || $ltarget || $lclass || $ltitle || $rel) {
882
			$ltargetForm = $this->wrapInForm($lpageId.$queryParameters.$ltarget.$lclass.$ltitle.$rel);
906
			$ltargetForm = $this->wrapInForm($lpageId . $queryParameters . $ltarget . $lclass . $ltitle . $rel . $additionalAttributeFields);
883 907
		}
884 908
		return $ltargetForm;
885 909
	}