libraries/tbs/plugins/tbs_plugin_opentbs.php
function XML_DeleteAttributes(&$Txt, $Pos, $AttLst, $StrLst)	{
		$end = strpos($Txt, '>', $Pos); // end of the element
		if ($end===false) return (strlen($Txt)-1);
		$x_len = $end - $Pos + 1;
		$x = substr($Txt, $Pos, $x_len);
		// delete attributes
		foreach ($AttLst as $att) {
			$a = ' '.$att.'="';
			$p1 = strpos($x, $a);
			if ($p1!==false) {
				$p2 = strpos($x, '"', $p1+strlen($a));
				if ($p2!==false) $x = substr_replace($x, '', $p1, $p2-$p1+1);
			}
		}
		// Delete strings
		foreach ($StrLst as $str) $x = str_replace('', $str, $x);
		$x_len2 = strlen($x);
		if ($x_len2!=$x_len) $Txt = substr_replace($Txt, $x, $Pos, $x_len);
		return $Pos + $x_len2;
	}
function XML_DeleteAttributes(&$Txt, $Pos, $AttLst, $StrLst)	{
		$end = strpos($Txt, '>', $Pos); // end of the element
		if ($end===false) return (strlen($Txt)-1);
		$x_len = $end - $Pos + 1;
		$x = substr($Txt, $Pos, $x_len);
		// delete attributes
		foreach ($AttLst as $att) {
			$a = ' '.$att.'="';
			$p1 = strpos($x, $a);
			if ($p1!==false) {
				$p2 = strpos($x, '"', $p1+strlen($a));
				if ($p2!==false) $x = substr_replace($x, '', $p1, $p2-$p1+1);
			}
		}
		// Delete strings
		foreach ($StrLst as $str) $x = str_replace('', $str, $x);
		$x_len2 = strlen($x);
		if ($x_len2!=$x_len) $Txt = substr_replace($Txt, $x, $Pos, $x_len);
		return $Pos + $x_len2;
	}
function XML_DeleteAttributes ( & $ Txt , $ Pos , $ AttLst , $ StrLst ) { $ end = strpos ( $ Txt , '>' , $ Pos ) ; // end of the element if ( $ end === false ) return ( strlen ( $ Txt ) - 1 ) ; $ x_len = $ end - $ Pos + 1 ; $ x = substr ( $ Txt , $ Pos , $ x_len ) ; // delete attributes foreach ( $ AttLst as $ att ) { $ a = ' ' . $ att . '="' ; $ p1 = strpos ( $ x , $ a ) ; if ( $ p1 !== false ) { $ p2 = strpos ( $ x , '"' , $ p1 + strlen ( $ a ) ) ; if ( $ p2 !== false ) $ x = substr_replace ( $ x , '' , $ p1 , $ p2 - $ p1 + 1 ) ; } } // Delete strings foreach ( $ StrLst as $ str ) $ x = str_replace ( '' , $ str , $ x ) ; $ x_len2 = strlen ( $ x ) ; if ( $ x_len2 != $ x_len ) $ Txt = substr_replace ( $ Txt , $ x , $ Pos , $ x_len ) ; return $ Pos + $ x_len2 ; }
Delete attributes in an XML element. The XML element is located by $Pos.
@param {string} $Txt Text containing XML elements.
@param {int}    $Pos Start of the XML element.
@param {array}  $AttLst List of attributes to search and delete
@param {array}  $StrLst List of strings to search and delete
@return {int} The new end of the element.
Delete attributes in an XML element . The XML element is located by $Pos .