Skip to content

Commit

Permalink
Merge pull request #463 from mroi/patch-5
Browse files Browse the repository at this point in the history
embed videos from Vimeo
  • Loading branch information
tobyzerner committed Mar 13, 2017
2 parents bab2c4b + a2deb3d commit 7e39257
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/config.defaults.php
Expand Up @@ -124,6 +124,7 @@

// Post formatting settings.
$config["esoTalk.format.youtube"] = true; // Automatically convert YouTube links to embeds?
$config["esoTalk.format.vimeo"] = true; // Automatically convert Vimeo links to embeds?
$config["esoTalk.format.mentions"] = true; // Allow @mentioning of members?
// Misc. settings.
Expand Down
6 changes: 6 additions & 0 deletions core/lib/ETFormat.class.php
Expand Up @@ -226,6 +226,12 @@ public function linksCallback($matches)
$height = 225;
return "<iframe class='video' type='text/html' width='$width' height='$height' src='https://www.youtube.com/embed/$id?$options' allowfullscreen frameborder='0'></iframe>";
}
if (!$this->inline and C("esoTalk.format.vimeo") and preg_match('%(?:vimeo\.com/)([0-9]+)%i', $matches[2], $vimeo)) {
$id = $vimeo[1];
$width = 400;
$height = 225;
return "<iframe class='video' type='text/html' width='$width' height='$height' src='https://player.vimeo.com/video/$id' allowfullscreen frameborder='0'></iframe>";
}

return $this->formatLink($matches[1].$matches[2], $matches[0]);
}
Expand Down

0 comments on commit 7e39257

Please sign in to comment.