diff --git a/system/includes/functions.php b/system/includes/functions.php
index bbf08ed..bf144f1 100644
--- a/system/includes/functions.php
+++ b/system/includes/functions.php
@@ -2037,9 +2037,9 @@ function parseNode($node, $child = null) {
$su = parse_url(site_url());
if (empty($child)) {
- if (isset($url['host']) && isset($su['host'])) {
- if ($url['host'] == $su['host']) {
- if (slashUrl($url['path']) == slashUrl($req)) {
+ if (isset($url['host']) && isset($su['host'])) {
+ if ($url['host'] == $su['host']) {
+ if (slashUrl($url['path']) == slashUrl($req)) {
$li = '
';
} else {
$li = '';
@@ -3034,9 +3034,21 @@ function get_video_id($url)
return;
}
- preg_match("/^(?:http(?:s)?:\/\/)?(?:www\.)?(?:m\.)?(?:youtu\.be\/|youtube\.com\/(?:(?:watch)?\?(?:.*&)?v(?:i)?=|(?:embed|v|vi|user)\/))([^\?&\"'>]+)/", $url, $matches);
+ $link = parse_url($url);
+
+ if(!isset($link['host'])) {
+ return $url;
+ }
- return $matches[1];
+ if (stripos($link['host'], 'youtube.com') !== false || stripos($link['host'], 'youtu.be') !== false) {
+ preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $url, $match);
+ return $match[1];
+ } elseif (stripos($link['host'], 'vimeo.com') !== false) {
+ preg_match('%^https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)(?:[?]?.*)$%im', $url, $match);
+ return $match[3];
+ } else {
+ return $url;
+ }
}
// Shorten the string