Plugin Directory

Changeset 1577492


Ignore:
Timestamp:
01/18/2017 06:30:13 PM (9 years ago)
Author:
billknechtel
Message:

Add Support for YT sharing and embed URLs

Location:
responsive-video-light/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • responsive-video-light/trunk/readme.txt

    r1573615 r1577492  
    2323Example Usage:
    2424
    25 For a YouTube video, you can specify either the full URL to the video or just the unique video ID, like this:
     25For a YouTube video, you can specify either full URL to the video or just the unique video ID, or the YouTube sharing or embed URLs, like this:
    2626
    2727    [responsive_youtube http://www.youtube.com/watch?v=NbCr0UyoFJA ]
    2828    [responsive_youtube NbCr0UyoFJA]
     29    [responsive_youtube https://youtu.be//NbCr0UyoFJA ]
     30    [responsive_youtube https://www.youtube.com/embed/NbCr0UyoFJA ]
    2931
    3032And if you want to specify whether or not you'd like the "related videos" to display, you can use the "rel" or "norel" parameters in the shortcode syntax, like this:
     
    7981
    8082== Changelog ==
     83
     84= 1.5.2 =
     85* Add support for youtu.be sharing URL
     86* Can also use the embed URL, but of course not the whoe embed code.
     87
     88= 1.5.1 =
     89* Remove final Twig vestige, update compatibility string
    8190
    8291= 1.5.0 =
  • responsive-video-light/trunk/responsive-video-light.php

    r1573615 r1577492  
    221221                if (preg_match('/^http[s]?:\/\/.*(v=([-0-9a-zA-Z_]*)).*$/', $attribute, $matches)) {
    222222                    $video_id = $matches[2];
     223                } elseif (preg_match('/^http[s]?:\/\/youtu.be\/([-0-9a-zA-Z_]*)/', $attribute, $matches)) {
     224                    $video_id = $matches[1];
     225                } elseif (preg_match('/^http[s]?:\/\/www.youtube.com\/embed\/([-0-9a-zA-Z_]*)/', $attribute, $matches)) {
     226                    $video_id = $matches[1];
    223227                } elseif (preg_match('/^[-0-9a-zA-Z_]*$/', $attribute)) {
    224228                    $video_id = $attribute;
Note: See TracChangeset for help on using the changeset viewer.