Add floating widget support #5

Merged
ogrecooper merged 8 commits from floating into main 2026-06-09 18:41:10 +00:00
Showing only changes of commit 3bcedb614b - Show all commits
+8 -10
View File
@@ -163,22 +163,20 @@ final class Widget {
} }
$tags = new WP_HTML_Tag_Processor($html); $tags = new WP_HTML_Tag_Processor($html);
while (true) { $tags->next_tag();
$found = false; $tags->set_bookmark('top');
foreach ($queries as $query) { foreach ($queries as $query) {
if ($tags->next_tag($query)) { $tags->seek('top');
$found = true; $found = false;
break; while ($tags->next_tag($query)) {
}
}
if (!$found) break;
if (!is_null($args['type_name']) && !empty($args['type_name']) && $tags->get_attribute('type') !== $args['type_name']) continue; if (!is_null($args['type_name']) && !empty($args['type_name']) && $tags->get_attribute('type') !== $args['type_name']) continue;
$found = true;
foreach ($attributes as $name => $value) { foreach ($attributes as $name => $value) {
$tags->set_attribute($name, $value); $tags->set_attribute($name, $value);
} }
} }
if ($found) break;
}
return $tags->get_updated_html(); return $tags->get_updated_html();
} }