section on their way to the RTE $keepTags = $this->getKeepTags('rte'); - $kUknown = $this->procOptions['dontProtectUnknownTags_rte'] ? 0 : 'protect'; // Default: remove unknown tags. + $kUknown = $this->procOptions['dontProtectUnknownTags_rte'] ? 0 : 'protect'; // Default: remove unknown tags. - $hSC = $this->procOptions['dontHSC_rte'] ? 0 : 1; // Default: re-convert literals to characters (that is < to <) + $hSC = $this->procOptions['dontHSC_rte'] ? 0 : 1; // Default: re-convert literals to characters (that is < to <) - $convNBSP = !$this->procOptions['dontConvAmpInNBSP_rte']?1:0; + $convNBSP = !$this->procOptions['dontConvAmpInNBSP_rte'] ? 1 : 0; // Divide the content into lines, based on LF: - $parts = explode(LF,$value); + $parts = explode(LF, $value); - foreach($parts as $k => $v) { + foreach ($parts as $k => $v) { // Processing of line content: - if (!strcmp(trim($parts[$k]),'')) { // If the line is blank, set it to + if (!strcmp(trim($parts[$k]), '')) { // If the line is blank, set it to - $parts[$k]=' '; + $parts[$k] = ' '; - } else { // Clean the line content: + } else { // Clean the line content: - $parts[$k]=$this->HTMLcleaner($parts[$k],$keepTags,$kUknown,$hSC); + $parts[$k] = $this->HTMLcleaner($parts[$k], $keepTags, $kUknown, $hSC); - if ($convNBSP) $parts[$k]=str_replace(' ',' ',$parts[$k]); + if ($convNBSP) { + $parts[$k] = str_replace(' ', ' ', $parts[$k]); - } + } + } // Wrapping the line in <$dT> is not already wrapped: $testStr = strtolower(trim($parts[$k])); - if (substr($testStr,0,4)!='
') { + if (substr($testStr, 0, 2) != '
') {
- // Only set p-tags if there is not already div or p tags:
+ // Only set p-tags if there is not already div or p tags:
- $parts[$k]='<'.$dT.'>'.$parts[$k].''.$dT.'>';
+ $parts[$k] = '<' . $dT . '>' . $parts[$k] . '' . $dT . '>';
}
}
}
// Implode result:
- return implode(LF,$parts);
+ return implode(LF, $parts);
}
/**
@@ -1385,34 +1389,34 @@
* @return string Output content
* @see divideIntoLines()
*/
- function internalizeFontTags($value) {
+ function internalizeFontTags($value) {
// Splitting into font tag blocks:
- $fontSplit = $this->splitIntoBlock('font',$value);
+ $fontSplit = $this->splitIntoBlock('font', $value);
- foreach($fontSplit as $k => $v) {
+ foreach ($fontSplit as $k => $v) {
- if ($k%2) { // Inside
+ if ($k % 2) { // Inside
- $fTag = $this->getFirstTag($v); // Fint font-tag
+ $fTag = $this->getFirstTag($v); // Fint font-tag
- $divSplit_sub = $this->splitIntoBlock('div,p',$this->removeFirstAndLastTag($v),1);
+ $divSplit_sub = $this->splitIntoBlock('div,p', $this->removeFirstAndLastTag($v), 1);
- if (count($divSplit_sub)>1) { // If there were div/p sections inside the font-tag, do something about it...
+ if (count($divSplit_sub) > 1) { // If there were div/p sections inside the font-tag, do something about it...
// traverse those sections:
- foreach($divSplit_sub as $k2 => $v2) {
+ foreach ($divSplit_sub as $k2 => $v2) {
- if ($k2%2) { // Inside
+ if ($k2 % 2) { // Inside
- $div_p = $this->getFirstTag($v2); // Fint font-tag
+ $div_p = $this->getFirstTag($v2); // Fint font-tag
- $div_p_tagname = $this->getFirstTagName($v2); // Fint font-tag
+ $div_p_tagname = $this->getFirstTagName($v2); // Fint font-tag
- $v2=$this->removeFirstAndLastTag($v2); // ... and remove it from original.
+ $v2 = $this->removeFirstAndLastTag($v2); // ... and remove it from original.
- $divSplit_sub[$k2]=$div_p.$fTag.$v2.''.''.$div_p_tagname.'>';
+ $divSplit_sub[$k2] = $div_p . $fTag . $v2 . '' . '' . $div_p_tagname . '>';
} elseif (trim(strip_tags($v2))) {
- $divSplit_sub[$k2]=$fTag.$v2.'';
+ $divSplit_sub[$k2] = $fTag . $v2 . '';
}
}
- $fontSplit[$k]=implode('',$divSplit_sub);
+ $fontSplit[$k] = implode('', $divSplit_sub);
}
}
}
- return implode('',$fontSplit);
+ return implode('', $fontSplit);
}
/**
@@ -1421,7 +1425,7 @@
* @return string Value of t3lib_div::getIndpEnv('TYPO3_SITE_URL');
* @see t3lib_div::getIndpEnv()
*/
- function siteUrl() {
+ function siteUrl() {
return t3lib_div::getIndpEnv('TYPO3_SITE_URL');
}
@@ -1431,7 +1435,7 @@
*
* @return string
*/
- function rteImageStorageDir() {
+ function rteImageStorageDir() {
return $this->rte_p['imgpath'] ? $this->rte_p['imgpath'] : $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir'];
}
@@ -1443,21 +1447,21 @@
* @param string Break character to use for linebreaks.
* @return string Output value
*/
- function removeTables($value,$breakChar='
') {
+ function removeTables($value, $breakChar = '
') {
// Splitting value into table blocks:
- $tableSplit = $this->splitIntoBlock('table',$value);
+ $tableSplit = $this->splitIntoBlock('table', $value);
// Traverse blocks of tables:
- foreach($tableSplit as $k => $v) {
+ foreach ($tableSplit as $k => $v) {
- if ($k%2) {
+ if ($k % 2) {
- $tableSplit[$k]='';
+ $tableSplit[$k] = '';
- $rowSplit = $this->splitIntoBlock('tr',$v);
+ $rowSplit = $this->splitIntoBlock('tr', $v);
- foreach($rowSplit as $k2 => $v2) {
+ foreach ($rowSplit as $k2 => $v2) {
- if ($k2%2) {
+ if ($k2 % 2) {
- $cellSplit = $this->getAllParts($this->splitIntoBlock('td',$v2),1,0);
+ $cellSplit = $this->getAllParts($this->splitIntoBlock('td', $v2), 1, 0);
- foreach($cellSplit as $k3 => $v3) {
+ foreach ($cellSplit as $k3 => $v3) {
- $tableSplit[$k].=$v3.$breakChar;
+ $tableSplit[$k] .= $v3 . $breakChar;
}
}
}
@@ -1465,7 +1469,7 @@
}
// Implode it all again:
- return implode($breakChar,$tableSplit);
+ return implode($breakChar, $tableSplit);
}
/**
@@ -1475,18 +1479,18 @@
* @param string Direction To databsae (db) or from database to RTE (rte)
* @return string Processed value
*/
- function defaultTStagMapping($code,$direction='rte') {
+ function defaultTStagMapping($code, $direction = 'rte') {
- if ($direction=='db') {
+ if ($direction == 'db') {
- $code=$this->mapTags($code,array( // Map tags
+ $code = $this->mapTags($code, array( // Map tags
- 'strong' => 'b',
- 'em' => 'i'
- ));
+ 'strong' => 'b',
+ 'em' => 'i'
+ ));
}
- if ($direction=='rte') {
+ if ($direction == 'rte') {
- $code=$this->mapTags($code,array( // Map tags
+ $code = $this->mapTags($code, array( // Map tags
- 'b' => 'strong',
- 'i' => 'em'
- ));
+ 'b' => 'strong',
+ 'i' => 'em'
+ ));
}
return $code;
}
@@ -1498,25 +1502,25 @@
* @param array Array of attributes from tag in which to search. More specifically the content of the key "style" is used to extract "width:xxx / height:xxx" information
* @return array Integer w/h in key 0/1. Zero is returned if not found.
*/
- function getWHFromAttribs($attribArray) {
+ function getWHFromAttribs($attribArray) {
- $style =trim($attribArray['style']);
+ $style = trim($attribArray['style']);
- if ($style) {
+ if ($style) {
- $regex='[[:space:]]*:[[:space:]]*([0-9]*)[[:space:]]*px';
+ $regex = '[[:space:]]*:[[:space:]]*([0-9]*)[[:space:]]*px';
// Width
$reg = array();
- preg_match('/width'.$regex.'/i',$style,$reg);
+ preg_match('/width' . $regex . '/i', $style, $reg);
$w = intval($reg[1]);
// Height
- preg_match('/height'.$regex.'/i',$style,$reg);
+ preg_match('/height' . $regex . '/i', $style, $reg);
$h = intval($reg[1]);
}
- if (!$w) {
+ if (!$w) {
$w = $attribArray['width'];
}
- if (!$h) {
+ if (!$h) {
$h = $attribArray['height'];
}
- return array(intval($w),intval($h));
+ return array(intval($w), intval($h));
}
/**
@@ -1525,53 +1529,53 @@
* @param string URL to analyse.
* @return array Information in an array about the URL
*/
- function urlInfoForLinkTags($url) {
+ function urlInfoForLinkTags($url) {
$info = array();
$url = trim($url);
- if (substr(strtolower($url),0,7)=='mailto:') {
+ if (substr(strtolower($url), 0, 7) == 'mailto:') {
- $info['url']=trim(substr($url,7));
+ $info['url'] = trim(substr($url, 7));
- $info['type']='email';
+ $info['type'] = 'email';
} else {
- $curURL = $this->siteUrl(); // 100502, removed this: 'http://'.t3lib_div::getThisUrl(); Reason: The url returned had typo3/ in the end - should be only the site's url as far as I see...
+ $curURL = $this->siteUrl(); // 100502, removed this: 'http://'.t3lib_div::getThisUrl(); Reason: The url returned had typo3/ in the end - should be only the site's url as far as I see...
- for($a=0;$a