From a2deb3d3b6185b3926a13165a2e5cbefcae9b4fb Mon Sep 17 00:00:00 2001 From: Michael Roitzsch Date: Mon, 13 Mar 2017 13:53:51 +0100 Subject: [PATCH] embed videos from Vimeo --- core/config.defaults.php | 1 + core/lib/ETFormat.class.php | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/core/config.defaults.php b/core/config.defaults.php index d02a2105..1750cb6b 100644 --- a/core/config.defaults.php +++ b/core/config.defaults.php @@ -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. diff --git a/core/lib/ETFormat.class.php b/core/lib/ETFormat.class.php index 85dd8381..3adc23c3 100644 --- a/core/lib/ETFormat.class.php +++ b/core/lib/ETFormat.class.php @@ -226,6 +226,12 @@ public function linksCallback($matches) $height = 225; return ""; } + 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 ""; + } return $this->formatLink($matches[1].$matches[2], $matches[0]); }