Compare commits

..

4 Commits

Author SHA1 Message Date
shadowdao be7db52eec Update DOM crawler to resolver PHP warning
Create Release / build (push) Successful in 3s
2025-01-26 12:30:03 -08:00
jknapp 059cc94063 Merge pull request 'updating docs and settings for release' (#1) from update-documentation into main
Create Release / build (push) Successful in 2s
Reviewed-on: CyberCoveLLC/fourth-wall-embed-wp#1
2025-01-11 03:58:05 +00:00
jknapp a68c898422 Merge branch 'main' into update-documentation 2025-01-11 03:57:58 +00:00
shadowdao faf1a4ec87 updating docs and settings for release 2025-01-10 19:57:13 -08:00
3 changed files with 19 additions and 3 deletions
+10 -1
View File
@@ -1,3 +1,12 @@
# fourth-wall-embed-wp # fourth-wall-embed-wp
A WordPress Plugin to embed a fourth wall embed A WordPress Plugin to embed a fourth wall embed.
### How to use the plugin
* Download the latest release from [releases](https://repo.anhonesthost.net/CyberCoveLLC/fourth-wall-embed-wp/releases)
* Upload the Plugin to WordPress
* In the WordPress Dashboard, Navigate to the Fourthwall settings page, and paste your store url.
* On the page you want have your store displayed, add the shortcode ```[fourthwall]```
This is an early release of the plugin, and if you can think of things that could be improved or find any bugs, please open an issue on the repository.
+1
View File
@@ -64,6 +64,7 @@ class fourthwall_settings {
submit_button(); submit_button();
echo ' </form>' . "\n"; echo ' </form>' . "\n";
echo ' <div><p>To use the fourthwall Embed, use the shortcode [fourthwall]</p></div>';
echo '</div>' . "\n"; echo '</div>' . "\n";
} }
+8 -2
View File
@@ -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,12 +44,17 @@ 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://latinosagainstspookyshit-shop.fourthwall.com'; $value = isset( $options['fourth_url'] ) ? $options['fourth_url'] : 'https://fourthwall.com';
$store_html = fwembed_parse_html($value); $store_html = fwembed_parse_html($value);
$store_render = '<div class="fw-store-parent">' . PHP_EOL . $store_html . PHP_EOL . '</div>'; $store_render = '<div class="fw-store-parent">' . PHP_EOL . $store_html . PHP_EOL . '</div>';
return $store_render; return $store_render;