diff --git a/README.md b/README.md index 7a954b5..46741aa 100644 --- a/README.md +++ b/README.md @@ -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} @@ -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'. diff --git a/ee1/pi.antenna.php b/ee1/pi.antenna.php index e346884..9608dea 100644 --- a/ee1/pi.antenna.php +++ b/ee1/pi.antenna.php @@ -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="; @@ -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); @@ -146,6 +147,21 @@ public function __construct() } + if(($TMPL->fetch_param('iframe_class') != FALSE || + $TMPL->fetch_param('iframe_id') != FALSE) && + strpos($video_info->html, "fetch_param('iframe_class') != FALSE) + { + $video_info->html = str_replace('html); + } + if($TMPL->fetch_param('iframe_id') != FALSE) + { + $video_info->html = str_replace('html); + } + } + + //Handle a single tag if ($mode == "single") { diff --git a/ee2/antenna/pi.antenna.php b/ee2/antenna/pi.antenna.php index 390f53f..b0d6a63 100644 --- a/ee2/antenna/pi.antenna.php +++ b/ee2/antenna/pi.antenna.php @@ -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) { @@ -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, "EE->TMPL->fetch_param('iframe_class')) + { + $video_info->html = str_replace('html); + } + if($this->EE->TMPL->fetch_param('iframe_id')) + { + $video_info->html = str_replace('html); + } + } //Handle a single tag