Compare commits
2 Commits
update-doc
...
main
Author | SHA1 | Date | |
---|---|---|---|
be7db52eec | |||
059cc94063 |
@ -5,8 +5,9 @@ function fwembed_parse_html($url = null) {
|
|||||||
throw new ValueError("Missing URL");
|
throw new ValueError("Missing URL");
|
||||||
}
|
}
|
||||||
$html = null;
|
$html = null;
|
||||||
|
libxml_use_internal_errors(true);
|
||||||
$dom = new DOMDocument();
|
$dom = new DOMDocument();
|
||||||
@$dom->loadHTML(file_get_contents($url));
|
@$dom->loadHTML(loadHTML5(file_get_contents($url)), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
|
||||||
$dom->documentURI = $url;
|
$dom->documentURI = $url;
|
||||||
$divs = $dom->getElementsByTagName('div');
|
$divs = $dom->getElementsByTagName('div');
|
||||||
foreach ($divs as $div) {
|
foreach ($divs as $div) {
|
||||||
@ -43,9 +44,14 @@ function fwembed_parse_html($url = null) {
|
|||||||
$html = $html . '<div class="product-tile"><a class="product-link" target="_blank" href="' . $url . $linkHref . '">' . $productHTML . '</a></div>';
|
$html = $html . '<div class="product-tile"><a class="product-link" target="_blank" href="' . $url . $linkHref . '">' . $productHTML . '</a></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
libxml_clear_errors();
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadHTML5($html) {
|
||||||
|
return '<!DOCTYPE html><html><body>' . $html . '</body></html>';
|
||||||
|
}
|
||||||
|
|
||||||
function fwembed_shortcode( $atts ) {
|
function fwembed_shortcode( $atts ) {
|
||||||
$options = get_option( 'fourthwall_settings_name' );
|
$options = get_option( 'fourthwall_settings_name' );
|
||||||
$value = isset( $options['fourth_url'] ) ? $options['fourth_url'] : 'https://fourthwall.com';
|
$value = isset( $options['fourth_url'] ) ? $options['fourth_url'] : 'https://fourthwall.com';
|
||||||
|
Loading…
Reference in New Issue
Block a user