Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ For ExpressionEngine 2 installation, the directory /antenna should be placed in
Usage
-------

{exp:antenna url='{the_youtube_or_vimeo_url}' max_width="232" max_height="323" wmode="transparent|opaque|window"}
{exp:antenna url='{the_youtube_or_vimeo_url}' max_width="232" max_height="323" wmode="transparent|opaque|window" iframe_class="class_name" iframe_id="id_name"}
{embed_code}
{video_title}
{video_author}
Expand All @@ -28,17 +28,21 @@ Usage
{/exp:antenna}


Set the max\_width and/or max\_height for whatever size your website requires. The video will be resized to be within those dimensions, and will stay at the correct proportions.
Set the `max_width` and/or `max_height` for whatever size your website requires. The video will be resized to be within those dimensions, and will stay at the correct proportions.

The optional wmode parameter can be used if you're experiencing issues positioning HTML content in front of the embedded media. It accepts values of transparent, opaque and window.
The optional `wmode` parameter can be used if you're experiencing issues positioning HTML content in front of the embedded media. It accepts values of transparent, opaque and window.

The `iframe_class` and `iframe_id` parameters will apply a class and/or id to your embed container if an iframe is returned.

If used as a single tag, it returns the HTML embed/object code for the video. If used as a pair, you get access to the 5 variables above and can use them in conditionals.

If you're using Vimeo, you get access to three more parameters:
If you're using Vimeo, you get access to five more parameters:

- vimeo_byline='true/false' -- Shows the byline on the video. Defaults to true.
- vimeo_title='true/false' -- Shows the title on the video. Defaults to true.
- vimeo_autoplay='true/false' -- Automatically start playback of the video. Defaults to false.
- vimeo_portrait='true/false' -- Whether or not to display the video creator's avatar in the video poster frame. Defaults to true.
- vimeo_color="888888" -- A hexadecimal color code to be used as the Vimeo control accent color.

**NOTE** For this to work with all urls please ensure that in Weblog/Channel -> Preferences, you have 'Automatically turn URLs and email addresses into links?' set to 'No'.

Expand Down
20 changes: 18 additions & 2 deletions ee1/pi.antenna.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ public function __construct()
$vimeo_title = ($TMPL->fetch_param('vimeo_title') == "false") ? "&title=false" : "";
$vimeo_autoplay = ($TMPL->fetch_param('vimeo_autoplay') == "true") ? "&autoplay=true" : "";
$vimeo_portrait = ($TMPL->fetch_param('vimeo_portrait') == "false") ? "&portrait=0" : "";

$vimeo_color = ($TMPL->fetch_param('vimeo_color') != FALSE) ? "&color=".$TMPL->fetch_param('vimeo_color') : "";

// If it's not YouTube, Vimeo, or Wistia, bail
if (strpos($video_url, "youtube.com/") !== FALSE) {
$url = "http://www.youtube.com/oembed?format=json&iframe=1&url=";
Expand All @@ -99,7 +100,7 @@ public function __construct()
return;
}

$url .= urlencode($video_url) . $max_width . $max_height . $wmode_param . $vimeo_byline . $vimeo_title . $vimeo_autoplay . $vimeo_portrait;
$url .= urlencode($video_url) . $max_width . $max_height . $wmode_param . $vimeo_byline . $vimeo_title . $vimeo_autoplay . $vimeo_portrait . $vimeo_color;

// checking if url has been cached
$cached_url = $this->_check_cache($url);
Expand Down Expand Up @@ -146,6 +147,21 @@ public function __construct()
}


if(($TMPL->fetch_param('iframe_class') != FALSE ||
$TMPL->fetch_param('iframe_id') != FALSE) &&
strpos($video_info->html, "<iframe") !== FALSE)
{
if($TMPL->fetch_param('iframe_class') != FALSE)
{
$video_info->html = str_replace('<iframe', '<iframe class="'.$TMPL->fetch_param('iframe_class').'"', $video_info->html);
}
if($TMPL->fetch_param('iframe_id') != FALSE)
{
$video_info->html = str_replace('<iframe', '<iframe id="'.$TMPL->fetch_param('iframe_id').'"', $video_info->html);
}
}


//Handle a single tag
if ($mode == "single")
{
Expand Down
16 changes: 16 additions & 0 deletions ee2/antenna/pi.antenna.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function Antenna()
$vimeo_title = ($this->EE->TMPL->fetch_param('vimeo_title') == "false") ? "&title=false" : "";
$vimeo_autoplay = ($this->EE->TMPL->fetch_param('vimeo_autoplay') == "true") ? "&autoplay=true" : "";
$vimeo_portrait = ($this->EE->TMPL->fetch_param('vimeo_portrait') == "false") ? "&portrait=0" : "";
$vimeo_color = ($this->EE->TMPL->fetch_param('vimeo_color')) ? "&color=".$this->EE->TMPL->fetch_param('vimeo_color') : "";

// If it's not YouTube, Vimeo, or Wistia, bail
if (strpos($video_url, "youtube.com/") !== FALSE) {
Expand Down Expand Up @@ -133,6 +134,21 @@ public function Antenna()
$video_info->html = substr($video_info->html, 0, $param_pos) . $embed_str . substr($video_info->html, $param_pos);
}
}


if(($this->EE->TMPL->fetch_param('iframe_class') ||
$this->EE->TMPL->fetch_param('iframe_id')) &&
strpos($video_info->html, "<iframe") !== FALSE)
{
if($this->EE->TMPL->fetch_param('iframe_class'))
{
$video_info->html = str_replace('<iframe', '<iframe class="'.$this->EE->TMPL->fetch_param('iframe_class').'"', $video_info->html);
}
if($this->EE->TMPL->fetch_param('iframe_id'))
{
$video_info->html = str_replace('<iframe', '<iframe id="'.$this->EE->TMPL->fetch_param('iframe_id').'"', $video_info->html);
}
}


//Handle a single tag
Expand Down