This topic is: not resolved

Fix bug in youtube url of sermons

  • cassioalmeidas
    Participant
    Post count: 20
    # 12 months ago

    The regular expression for the imic_video_youtube function that starts at line 368 of the file ‘/NativeChurch/imic-framework/imic-theme-functions.php’ can not match the youtube url “https://www.youtube.com/watch?v=w-yxckjM1HI”, to fix I made the following change:

    as it was before:

    if (! function_exists (‘imic_video_youtube’)) {
        function imic_video_youtube ($ url, $ width = 200, $ height = 150, $ autopaly) {
            if (stristr ($ url, ‘youtu.be /’))
            {preg_match (‘/ (https: | http: |) (\ / \ / www \. | \ (| *?) \ / (. {11}) / i’, $ url, ); return ‘<iframe itemprop = “video” src = “https://youtube.com/embed/’ $ video_id [4]. ‘? autoplay =’. $ autopaly. ‘& rel = 0″ width = width. ‘”height =”‘. height. ‘”allowfullscreen =” allowfullscreen “> </ iframe>’; }
        else
            {preg_match (‘/ (https: | http: |): (\ / \ / www \. | \ / \ / |) (i), v (i), i (i), and i (i)). return ‘<iframe itemprop = “video” src = “https://youtube.com/embed/’ $ video_id [6]. ‘? autoplay =’. $ autopaly. ‘& rel = 0” width = “‘. $ width. ‘”height =”‘. height. ‘”allowfullscreen =” allowfullscreen “> </ iframe>’;
    }
        }
    }

    My change:

    if (! function_exists (‘imic_video_youtube’)) {
        function imic_video_youtube ($ url, $ width = 200, $ height = 150, $ autopaly) {

        preg_match (‘/^.* ((youtu.be \ /) | (v \ /) | (\ / u \ / \ w \ /) | (embed \ /) | (watch \?)) \ v ? =? ([^ # \ & \?] *). * / i ‘, $ url, $ video_id);

        return ‘<iframe itemprop = “video” src = “https://youtube.com/embed/’ $ video_id [7]. ‘? autoplay =’. $ autopaly. ‘& rel = 0″ width = width. ‘”height =”‘. height. ‘”allowfullscreen =” allowfullscreen “> </ iframe>’;
        }
    }

    These are the types of URLs supported:

    “http://www.youtube.com/watch?v=0zM3nApSvMg&feature=feedrec_grec_index”
    “http://www.youtube.com/user/IngridMichaelsonVEVO#p/a/u/1/QdK8U-VIH_o”
    “http://www.youtube.com/v/0zM3nApSvMg?fs=1&hl=en_US&rel=0”
    “http://www.youtube.com/watch?v=0zM3nApSvMg#t=0m10s”
    “http://www.youtube.com/embed/0zM3nApSvMg?rel=0”
    “http://www.youtube.com/watch?v=0zM3nApSvMg”
    “http://youtu.be/0zM3nApSvMg”

    SupportSupport
    Participant
    Post count: 5
    # 12 months ago

    Thanks for contacting imithemes support, support staff will contact you shortly and assist you at above query.

    Support response time can be upto 24-48 hours on weekdays and 48-72 hours on weekends.

    please be patient

    AuthorAuthor
    Keymaster
    Post count: 26641
    # 12 months ago

    Hi, thanks I have noted it!

    herzblutloewe
    Participant
    Post count: 11
    # 2 weeks, 5 days ago
    This reply has been marked as private.
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.