Skip to content

Instantly share code, notes, and snippets.

@mrkodssldrf
Created September 23, 2012 11:16
Show Gist options
  • Save mrkodssldrf/3769734 to your computer and use it in GitHub Desktop.
Save mrkodssldrf/3769734 to your computer and use it in GitHub Desktop.
PyroCMS Video Plugin
<?php
/**
* Video Plugin
*
* Plugin to fetch Videos from various Sites
*
* youtube: {{video:youtube id="youtubeid"}}
* vimeo: {{video:vimeo id="vimeoid"}}
*
* @author Mirko Düßeldorf
* @package PyroCMS/addons/plugin
* @copyright Copyright (c) 2012, Mirko Düßeldorf
*/
class Plugin_Video extends Plugin {
public function youtube() {
$youtubeId = $this->attribute('id', null);
$width = $this->attribute('width', '640');
$height = $this->attribute('height', '360');
if(!is_null($youtubeId)) {
$youtubeCode = '<iframe width="'.$width.'" height="'.$height.'" src="http://www.youtube.com/embed/'.$youtubeId.'" frameborder="0" allowfullscreen></iframe>';
return $youtubeCode;
}
}
public function vimeo() {
$vimeoId = $this->attribute('id', null);
$width = $this->attribute('width', '640');
$height = $this->attribute('height', '360');
if(!is_null($vimeoId)) {
$vimeoCode = '<iframe src="http://player.vimeo.com/video/'.$vimeoId.'" width="'.$width.'" height="'.$height.'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
return $vimeoCode;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment