• Resolved sactobob

    (@sactobob)


    My Joomla pages have several script tags at the beginning of each page to embedded rumble such as:

    <div class="hentry" data-sync="textbox_content"><span style="color: red; font-size: x-large;">Dog Rope Toy</span>
    <p><script>!function(r,u,m,b,l,e){r._Rumble=b,r[b]||(r[b]=function(){(r[b]._=r[b]._||[]).push(arguments);if(r[b]._.length==1){l=u.createElement(m),e=u.getElementsByTagName(m)[0],l.async=1,l.src="https://rumble.com/embedJS/uwkr1e"+(arguments[1].video?'.'+arguments[1].video:'')+"/?url="+encodeURIComponent(location.href)+"&args="+encodeURIComponent(JSON.stringify([].slice.apply(arguments))),e.parentNode.insertBefore(l,e)}})}(window, document, "script", "Rumble");</script></p>
    <div id="rumble_v3t6t3h"> </div>
    <p><script><br />
    Rumble("play", v3t6t3h);</script></p>

    The imported post is getting modified to

    <p><script>!function(r,u,m,b,l,e){r._Rumble=b,r[b]||(r[b]=function(){(r[b]._=r[b]._||[]).push(arguments);if(r[b]._.length==1){l=u.createElement(m),e=u.getElementsByTagName(m)[0],l.async=1,l.src="https://rumble.com/embedJS/uwkr1e"+(arguments[1].video?'.'+arguments[1].video:'')+"/?url="+encodeURIComponent(location.href)+"&args="+encodeURIComponent(JSON.stringify([].slice.apply(arguments))),e.parentNode.insertBefore(l,e)}})}(window, document, "script", "Rumble");</script></p>
    <div id="rumble_v3t6t3h"> </div>
    <p><script><br />
    Rumble("play", v3t6t3h);</script></p>


    The adding of <p> </p> <br /> is odd and causing other issues, but the last Rumble line is breaking the playing since the div tag is gone and the video tag is corrupted.

    I’ve tried some pre-filters(via code snippet) with no luck, I’m not sure if this it the import itself or WP/Theme (Pagelayer/PopularFX) is modifying on-the-fly the import as well creating the issue. This also causes pagelayer to break with a critical error when trying to edit theme/blog template.

    Edit: Not the theme, I temporarily switched to twenty-twentyfive and same issue after import. Maybe a core WP function?

    Any ideas?

    Thanks you,

    • This topic was modified 9 months, 3 weeks ago by sactobob.
    • This topic was modified 9 months, 3 weeks ago by sactobob.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter sactobob

    (@sactobob)

    After trying various methods to disable content filtering, I took a look at the code, and found it already does this! (Make sense). The issue is this function is corrupting the JSON, I temporarily put a “return $content” at the top of the function and the Rumble code imported fine!

        private function process_audio_video_links($content) {
    // return $content; //Added as a work-around to Rumble Corruption
    if ( strpos($content, '{"video"') !== false ) {
    $content = preg_replace('/(<p>)?{"video":"(.*?)".*?}(<\/p>)?/', "$2", $content);
    }
    if ( strpos($content, '{audio}') !== false ) {
    $content = preg_replace('#{audio}(.*?){/audio}#', "$1", $content);
    }
    return $content;
    }
    Plugin Author Kerfred

    (@kerfred)

    I have tried to reproduce your issue. But I couldn’t. The content is not changed at all by the import.

    Your content should not be changed by the function process_audio_video_links because it doesn’t contain neither {"video" nor {audio}.

    Thread Starter sactobob

    (@sactobob)

    Oh, looking at my original post, the top (Joomla) version was wrong, it appears to be the modified one from an sql query. Here’s the Joomla content of one of the posts:

    <script>!function(r,u,m,b,l,e){r._Rumble=b,r[b]||(r[b]=function(){(r[b]._=r[b]._||[]).push(arguments);if(r[b]._.length==1){l=u.createElement(m),e=u.getElementsByTagName(m)[0],l.async=1,l.src="https://rumble.com/embedJS/uwkr1e"+(arguments[1].video?'.'+arguments[1].video:'')+"/?url="+encodeURIComponent(location.href)+"&args="+encodeURIComponent(JSON.stringify([].slice.apply(arguments))),e.parentNode.insertBefore(l,e)}})}(window, document, "script", "Rumble");</script>
    <script>
    Rumble("play", {"video":"v6uy05s","div":"rumble_v6uy05s"});</script>
    Desires are powerful, emotional longings that come from deep within, while wants are often temporary and surface-level wishes. Desires drive meaningful actions and shape our goals, whereas wants tend to be more about immediate satisfaction. Unlike wants, which can change quickly, desires usually reflect core values and lasting yearnings.



    Plugin Author Kerfred

    (@kerfred)

    Ah OK. In this case, this content is modified by the function process_audio_video_links because it contains {"video".

    For your case, you can just comment out these lines:

    // if ( strpos($content, '{"video"') !== false ) {
    // $content = preg_replace('/(<p>)?{"video":"(.*?)".*?}(<\/p>)?/', "$2", $content);
    // }

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘script tags getting modified during import’ is closed to new replies.