Wowee! That look just the thing...nearly.
This only seems to work for the first link it finds on the page!?
Link removal (JS Regex)
Moderator: General Moderators
It queries all required nodes using Xpath, then iterates over the results and replaces them accordingly.
XPath to DOM is like SQL to RDBMS
... much like:
XPath to DOM is like SQL to RDBMS
Code: Select all
$res = mysql_query("
SELECT
`link`.`id` as `link_id`,
`font`.`id` as `font_id`,
`font`.`content`
FROM
`DomElements` `link`
INNER JOIN
`DomElements` `font`
ON `font`.`parent` = `link`.`id`
WHERE
`link`.`nodeName` = 'A'
AND `font`.`nodeName` = 'FONT'
AND `link`.`target`
");
while(list($link_id, $font_id, $content) = mysql_fetch_row($res)) {
mysql_query("DELETE FROM `DomElements` WHERE `id` in ($link_id, $font_id)");
mysql_query("INSERT INTO `DomElements` SET `nodeName` = `text`, `content`='$content'");
}