0
"type" => "text_block",
0
"label" => __("Video", "video"),
0
- "bookmarklet" => (isset($_GET['url']) and
0
- preg_match("/http:\/\/(www\.|[a-z]{2}\.)?youtube\.com\/watch\?v=([^&]+)/",
0
+ "bookmarklet" => $this->isVideo() ?
0
$this->setField(array("attr" => "caption",
0
"bookmarklet" => "selection"));
0
- $this->bookmarkletSelected(isset($_GET['url']) and
0
- preg_match("/http:\/\/(www\.|[a-z]{2}\.)?youtube\.com\/watch\?v=([^&]+)/",
0
+ $this->bookmarkletSelected($this->isVideo());
0
$this->setFilter("caption", "markup_post_text");
0
public function embed_tag($video) {
0
if (preg_match("/http:\/\/(www\.|[a-z]{2}\.)?youtube\.com\/watch\?v=([^&]+)/", $video, $matches)) {
0
return '<object type="application/x-shockwave-flash" class="object-youtube" data="http://'.$matches[1].'youtube.com/v/'.$matches[2].'" width="468" height="391"><param name="movie" value="http://'.$matches[1].'youtube.com/v/'.$matches[2].'" /><param name="FlashVars" value="playerMode=embedded" /></object>';
0
+ } else if (preg_match("/http:\/\/(www\.)?vimeo.com\/([0-9]+)/", $video, $matches)) {
0
+ $site = get_remote($video);
0
+ preg_match('/<div id="vimeo_player_1397502" class="player" style="width:([0-9]+)px;height:([0-9]+)px;">/',
0
+ return '<object type="application/x-shockwave-flash" class="object-vimeo" width="'.$scale[1].'" height="'.$scale[2].'" data="http://www.vimeo.com/moogaloop.swf?clip_id='.$matches[2].'&server=www.vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=00adef&fullscreen=1"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id='.$matches[2].'&server=www.vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=00adef&fullscreen=1" /></object>';
0
+ public function embed_tag_for($post, $max_width = 500) {
0
+ preg_match('/width=("|\')([0-9]+)("|\') height=("|\')([0-9]+)("|\')/', $post->embed, $scale);
0
+ if ($width < $max_width)
0
+ $height = ($max_width / $width) * $height;
0
+ return str_replace($match, 'width="'.$max_width.'" height="'.$height.'"', $post->embed);
0
+ public function isVideo() {
0
+ if (!isset($_GET['url']))
0
+ if (preg_match("/http:\/\/(www\.|[a-z]{2}\.)?youtube\.com\/watch\?v=([^&]+)/", $_GET['url']))
0
+ if (preg_match("/http:\/\/(www\.)?vimeo.com\/([0-9]+)/", $_GET['url']))