-
-
Save tejastank/3835657 to your computer and use it in GitHub Desktop.
PyroCMS Video Plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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