http://www.youtube.com/watch?v={ID}
http://www.youtube.com/watch?v={ID}&{Parameters}
http://www.m.youtube.com/watch?v={ID}
http://youtu.be/{ID}
http://www.youtube.com/watch?feature=player_embedded&v=[ID]
http://vimeo.com/[ID]
http://vimeo.com/channels/[channel name]/[ID]
http://vimeo.com/group/[ID]
http://vimeo.com/album/[ID]
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
1.2.11 - May 07, 2020
- Add French translation, thanks to BrunoR
- Correctly delete language files
1.2.10 - March 10, 2019
- Add Polish translation, thanks to jsx and FishingManMatt
- Correctly delete language files on uninstall
- Spanish word corrections
1.2.10 - March 12, 2017
- Fix the "/>" appearing on autoembed
- Fix support for gifv
- Add a link to the video if JavaScript is disabled
1.2.8 - Oct 25, 2016
- Improve regex for gifv and youtube urls.
- Pass the ID when using url auto parsing, prevents using another regex to get it.
- Use global scope inside closures.
1.2.7 - Aug 12, 2016,
- Set basedWidth and basedHeight to prevent weird behavior on non responsive themes.
1.2.6 - May 29, 2016,
- Add support for full screen videos.
- Remove multiple calls to this.responsive().
- Check the width and height of parent div before applying changes.
1.2.5 - February 18, 2016,
- Added support for imgur gifv format
- Move the css and js calls to integrate_load_theme hook.
1.2.4 - August 2, 2015,
- Added responsiveness to videos. This will only work on responsive themes.
- Fixed an issue when two or more instances of the same video where posted, none of them would be played.
- Re-wrote the JS code to use prototypes.
- Change the default size values to 480 x 270.
1.2.3 - June 26, 2015,
- Added a minified js file.
- Added support for using the youtube ID as param.
- License change to MPL 2.0.
1.2.2 - April 05, 2015,
- Force loading the oharaEmbed.css file from the default theme.
- Add more options to show video preview images
- Add support for previewing a message
- Improve handling of youtube thumbnails and overall JS improvements.
- Add a setting to enable/disable the autoembed feature. This was suppose to be added a long time ago but dunno why I forgot to do it...
- Missed to check the master setting.
1.2.1 - March 09, 2015,
- Added the option to disable the autoembed feature via $context['ohara_disable'].
- Use closures instead of create_function()
- Change the way youtube videos are displayed, faster pages specially with multiple videos, thanks to Infernuza for the tip.
1.2 - March 05, 2014,
- Added auto-embed feature.
- Add support for old [nobbc][yt][/yt][/nobbc] tags
- Add support for [nobbc][vimeo][/vimeo][/nobbc]
1.1 - April 19, 2013,
- Fix the http/https url issue.
- Fixed the parsing smiles after a video issue.
- Fixed the pass by reference issue.
- Updated the regex to include more valid urls.
1.0.1 - Dic 28, 2011,
-Fix the youtube redirect page error if you use the initial tag alone: [youtube]
1.0 - Sep 25, 2011,
-Initial Release
Announcement concerning [youtube] tags. You can now use [youtube] tags to embed your youtube videos.
Like this:
[youtube]http://www.youtube.com/watch?v=wifH74R3yJA[/youtube]
Annoucnement concerning
[BIG BLANK BOX]
$codes[] = array(
'tag' => 'youtube',
'type' => 'unparsed_content',
'content' => '$1',
'validate' => create_function('&$tag, &$data, $disabled', '
global $txt;
if (empty($data))
$data = $txt[\'OYTE_unvalid_link\'];
else
{
$data = trim(strtr($data, array(\'<br />\' => \'\')));
$data = OYTE_Main($data);
}
'),
'disabled_content' => '$1',
'block_level' => true,
'test' => '(http://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)[/youtube]'
);
[youtube]http://youtu.be/x1yOGhnmYfI[/youtube]
[youtube]http://youtu.be/V3hxPnG0GeE[/youtube]
[youtube]http://youtu.be/JM2PRqR9WeA[/youtube]
[youtube]http://www.youtube.com/watch?v=JM2PRqR9WeA[/youtube]
Can I have a regular user account to test this further.
<?php
global $txt;
$txt['OYTE_master'] = 'Enable the Ohara Youtube Embed mod';
$txt['OYTE_master_sub'] = 'This is the master setting, it needs to be enable for the mod to work.';
$txt['OYTE_video_width'] = 'Video\'s width:';
$txt['OYTE_video_width_sub'] = 'If empty it will take the default value: 420.';
$txt['OYTE_video_height'] = 'Video\'s height:';
$txt['OYTE_video_height_sub'] = 'If empty it will take the default value: 315';
$txt['OYTE_desc'] = 'Embed a youtube video url';
$txt['OYTE_unvalid_link'] = 'Not a valid youtube URL %s';
$txt['OYTE_title'] = 'Ohara Youtube Embed mod';
?>
What SMF version are you using?
Why didn't you use the packager manager?
If you installed manually you must run the install script for the hooks to be inserted on the DB
OYTE_Who(),
/* DUH! WINNING! */
function OYTE_Who()
{
$MAS = '<a href="http://missallsunday.com" title="Free SMF Mods">Ohara YouTube Embed mod © Suki</a>';
return $MAS;
}
The copyright is displayed on the credits action:
http://www.simplemachines.org/community/index.php?action=credits
http://missallsunday.com/credits/
You need to manually run the install file to apply the hooks, download the mod, unzip it, upload the database.php file to your forum root folder (where SSI.php is) and call it with your browser: mysite.com/forum/database.php
I have installed the Mod, used the tags, but all it does is place the tags before and after the URL link. Does not embed. Any idea why?
This is great, thanks! ;D
Noticed a little problem on my forum - whenever I have a smiley after a YouTube video in the same post, the smiley image doesn't appear, just the code for the smiley. They work fine when posted above the video though.
Don't know if this happens on all forums (I'm on 2.0.2, I have a couple of other mods installed and a modified template) but thought I should say anyway, just in case!
Cheers! :D
$height = empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height'];
/* Return the HTML */
$return = '
<div style="text-align:center;margin:auto;padding:5px;" class="youtube '.$string.'">
<iframe width="'.$width.'" height="'.$height.'" src="http://www.youtube.com/embed/'.$string.'" frameborder="0"></iframe>
</div>';
return $return;
$height = empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height'];
// This grabs the video info
$videoinfo = file_get_contents("http://www.youtube.com/oembed?url=http%3A//youtube.com/watch%3Fv%3D".$string."&format=json");
// Position where the Video's Title begins
$pos_start = 10 + strpos($videoinfo, '"title": "');
// Position where the Video's Title ends
$pos_end = strpos($videoinfo, '", "html":');
// The length of the Title
$pos_length = $pos_end - $pos_start;
// Pulls only the Title from the video info
$video_title = substr($videoinfo, $pos_start, $pos_length);
// Trim the Title if it is longer than 50 characters
if ($pos_length > 50)
$video_title = substr($video_title,0,50) . '...';
// I am using the old display method that includes the video controls. Replace the <object></object> bit with the newer YouTube iFrame method if desired
// I set the title's link to open in a new tab. This is not how vB does it, but I prefer it this way.
$return = '
<span>
<div style="text-align: center;">
<table width="' . $width . '" cellspacing="2" cellpadding="0" align="center" style="margin: auto; border: 1px solid #9999AA;">
<tbody>
<tr>
<td width="' . $width . '"><h3 class="catbg" style="font-weight: normal;"><a href="http://www.youtube.com/watch?v=' . $string . '" target="_blank">YouTube - ' . $video_title . '</a></h3></td>
</tr>
<tr height="400">
<td style="background: none repeat scroll 0 0 #000000; line-height: 0;">
<object width="' . $width . '" height="' . $height . '">
<param name="movie" value="http://www.youtube.com/v/' . $string . '&rel=0&hl=en_US&feature=player_embedded&version=1"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowScriptAccess" value="always"></param>
<embed src="http://www.youtube.com/v/' . $string . '&rel=0&hl=en_US&feature=player_embedded&version=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="' . $width . '" height="' . $height . '"></embed>
</object>
</td>
</tr>
</tbody>
</table>
</div>
</span>';
return $return;
Original method: (http://i704.photobucket.com/albums/ww46/rakudasama/MCI/th_yt-old.gif) (http://i704.photobucket.com/albums/ww46/rakudasama/MCI/yt-old.gif) | New method: (http://i704.photobucket.com/albums/ww46/rakudasama/MCI/th_yt-new.gif) (http://i704.photobucket.com/albums/ww46/rakudasama/MCI/yt-new.gif) |
YouTube has an API where you can get all info from a video, you just need to pass the video ID, I wanted to include that API on this mod but unfortunately I haven't had the time to do so.[ace ventura]Ohhh reeeheeeeeheeeeheeeeaaaaaaalllllllllllllllly[/ace ventura]
/* The bbc button */
function OYTE_bbc_add_button($buttons)
{
global $txt, $modSettings;
loadLanguage('OharaYTEmbed');
if (empty($modSettings['OYTE_master']))
return;
$buttons[count($buttons) - 1][] = array(
'image' => 'youtube',
'code' => 'youtube',
'before' => '[youtube]',
'after' => '[/youtube]',
'description' => $txt['OYTE_desc'],
);
}
$doc = new DOMDocument;
$doc->load("http://gdata.youtube.com/feeds/api/videos/" . $string);
$video_title = $doc->getElementsByTagName("title")->item(0)->nodeValue;
{
"provider_url": "http:\/\/www.youtube.com\/"
"thumbnail_url": "http:\/\/i1.ytimg.com\/vi\/8mrFkpYKJ6Q\/hqdefault.jpg"
"title": "BigMike's 511:1 Marlin Crawler Parking Stall Burn Out"
"html": "\u003ciframe width=\"480\" height=\"270\" src=\"http:\/\/www.youtube.com\/embed\/8mrFkpYKJ6Q?fs=1\u0026feature=oembed\" frameborder=\"0\" allowfullscreen\u003e\u003c\/iframe\u003e"
"author_name": "MarlinCrawlerMedia"
"height": 270, "thumbnail_width": 480, "width": 480, "version": "1.0"
"author_url": "http:\/\/www.youtube.com\/user\/MarlinCrawlerMedia"
"provider_name": "YouTube"
"type": "video"
"thumbnail_height": 360
}
SimpleXMLElement Object
(
[id] => http://gdata.youtube.com/feeds/api/videos/8mrFkpYKJ6Q
[published] => 2012-05-02T01:04:14.000Z
[updated] => 2012-08-01T03:14:03.000Z
[category] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[scheme] => http://schemas.google.com/g/2005#kind
[term] => http://gdata.youtube.com/schemas/2007#video
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[scheme] => http://gdata.youtube.com/schemas/2007/categories.cat
[term] => People
[label] => People & Blogs
)
)
)
[title] => BigMike's 511:1 Marlin Crawler Parking Stall Burn Out
[content] => Our customer Rick Crarey from Canada and Marlin got to check out BigMike's Crawler doing a 511:1 parking stall burn out. The engine is idling at 800 rpm. Triple Marlin Crawler Ultimate Setup
[link] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[rel] => alternate
[type] => text/html
[href] => http://www.youtube.com/watch?v=8mrFkpYKJ6Q&feature=youtube_gdata
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[rel] => http://gdata.youtube.com/schemas/2007#video.responses
[type] => application/atom+xml
[href] => http://gdata.youtube.com/feeds/api/videos/8mrFkpYKJ6Q/responses
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[rel] => http://gdata.youtube.com/schemas/2007#video.related
[type] => application/atom+xml
[href] => http://gdata.youtube.com/feeds/api/videos/8mrFkpYKJ6Q/related
)
)
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[rel] => http://gdata.youtube.com/schemas/2007#mobile
[type] => text/html
[href] => http://m.youtube.com/details?v=8mrFkpYKJ6Q
)
)
[4] => SimpleXMLElement Object
(
[@attributes] => Array
(
[rel] => self
[type] => application/atom+xml
[href] => http://gdata.youtube.com/feeds/api/videos/8mrFkpYKJ6Q
)
)
)
[author] => SimpleXMLElement Object
(
[name] => MarlinCrawlerMedia
[uri] => http://gdata.youtube.com/feeds/api/users/MarlinCrawlerMedia
)
)
try to change this:
function OYTE_bbc_add_button($buttons)
with this:
function OYTE_bbc_add_button(&$buttons)
(http://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)
((http|https)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)
Ok, updated my video title retrieval code with a more simple approach using an XML object that takes 2 less lines:Code: [Select]$doc = new DOMDocument;
$doc->load("http://gdata.youtube.com/feeds/api/videos/" . $string);
$video_title = $doc->getElementsByTagName("title")->item(0)->nodeValue;
$video = json_decode(file_get_contents("http://www.youtube.com/oembed?url=http%3A//youtube.com/watch%3Fv%3D".$string."&format=json"), TRUE);
$video['title']
to print out the video's title.Array
(
[provider_name] => YouTube
[width] => 459
[title] => John drives BigMike's Truck at 511:1 Crawl Ratio
[author_url] => http://www.youtube.com/user/Husoku
[version] => 1.0
[thumbnail_height] => 360
[provider_url] => http://www.youtube.com/
[thumbnail_url] => http://i3.ytimg.com/vi/6LoQTme51tA/hqdefault.jpg
[thumbnail_width] => 480
[type] => video
[html] => ****this is the full ready-to-use embed code here****
[height] => 344
[author_name] => Husoku
)
Open Sources/OharaYTEmbed.php and find:Code: [Select](http://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)
There are 2 instances of this string, make the change to both.
and replace with this:Code: [Select]((http|https)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)
Back up the file first before doing the change as I haven't tested this change.
[youtube]http://www.youtube.com/watch?v=44NFSbjjGl4&list=PLWxJthc4qU_ZF7xNDwcrbQtxlVe3SzKDQ[/youtube]
http://www.youtube.com/watch?v={ID}&{Parameters}
Open Sources/OharaYTEmbed.php and find:Code: [Select](http://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)
There are 2 instances of this string, make the change to both.
and replace with this:Code: [Select]((http|https)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)
Back up the file first before doing the change as I haven't tested this change.
The mod doesn't modify Subs.php at all, the mod sues it's own file: OharaYTEmbed.php
Make sure the following code is presented on that file:Code: [Select]/* The bbc button */
function OYTE_bbc_add_button($buttons)
{
global $txt, $modSettings;
loadLanguage('OharaYTEmbed');
if (empty($modSettings['OYTE_master']))
return;
$buttons[count($buttons) - 1][] = array(
'image' => 'youtube',
'code' => 'youtube',
'before' => '[youtube]',
'after' => '[/youtube]',
'description' => $txt['OYTE_desc'],
);
}
If there is, try to change this:
function OYTE_bbc_add_button($buttons)
with this:
function OYTE_bbc_add_button(&$buttons)
i had an issue with my post.php . and since then , it stop working
even i uninstalled and reinstall the mod , yet it's not working. please wat do i need to fix inside post.php or anywhere so i can use it again???
i had an issue with my post.php . and since then , it stop working
even i uninstalled and reinstall the mod , yet it's not working. please wat do i need to fix inside post.php or anywhere so i can use it again???
Can you be more specific. What issue with post.php and what do you mean by stop working?
If that is the only mod installed, why not un-install it and then refresh post.php from the SMF distribution you used.
i had an issue with my post.php . and since then , it stop working
even i uninstalled and reinstall the mod , yet it's not working. please wat do i need to fix inside post.php or anywhere so i can use it again???
Can you be more specific. What issue with post.php and what do you mean by stop working?
If that is the only mod installed, why not un-install it and then refresh post.php from the SMF distribution you used.
i had issues with my post.php, so i removed it and added fresh post.php.
i have found out that some of my mod that got to do with post are no longer working. i removed and reinstall all of them including this Mod . but this seems not to respond.
i embedded a youtube video yet it's not working while the previous videos (before the issue came up) are all working but new one refuses to work!
If there is, try to change this:
function OYTE_bbc_add_button($buttons)
with this:
function OYTE_bbc_add_button(&$buttons)
Open Sources/OharaYTEmbed.php and find:Code: [Select](http://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)
There are 2 instances of this string, make the change to both.
and replace with this:Code: [Select]((http|https)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)
Back up the file first before doing the change as I haven't tested this change.
When you stop playing and modifying your files then the mod will cease "stop working" ;D. As simple as that.
'(https?://(?:www\.)?youtu(?:be\.com/watch\?(?:[\w\?=]*&(?:amp;)?)*v=|\.be/)(\w*)(?:&(?:amp;)?[\w\?=]*)*)'
function OYTE_bbc_add_button($dummy)
{
global $txt, $modSettings, $context;
loadLanguage('OharaYTEmbed');
if (empty($modSettings['OYTE_master']))
return;
$context['bbc_tags'][count($context['bbc_tags']) - 1][] = array(
'image' => 'youtube',
'code' => 'youtube',
'before' => '[youtube]',
'after' => '[/youtube]',
'description' => $txt['OYTE_desc'],
);
}
that is simple nonsense, hooks have been in SMF code as earlier as 1.1 version and the most widely used hooks are here since early RC versions of 2.0
I haven't tried the author's simpler suggestion of adding an & in front of the routine parameter in the original code; I had already found my correction, which works, and so have stuck with it
What I don't understand is why the original, without the &, ever worked at all
So, yes, I no longer want to keep working on this or any other mod for that matter, it doesn't matter how much time I spent working on mods, I got nothing in return except complains.
I think you for providing this mod in the first place;
I built this because I wanted to know how the BBC hook works, this mod was built because of that, for all I know, this mod has fulfilled its purpose already since I know how the BBC hook works now.
Faulty? Yes, once the parameter no longer worked with a current version of PHP. But, as I said, it's up to you whether or not to keep your mod up to date.
One difference between me and you (and other around here, it seems) is that in 44 years coding (yes, I am that old), while I like the satisfaction of doing something right, and also the satisfaction of seeing my code used, I have never looked for thanks other than from my employers.
QuoteBut, as I said, it's up to you whether or not to keep your mod up to date.
It's also clear you believe that people who release things should be 'encouraged' to keep it in sync with other changes.
How often do you make something, give it away for free and then have to keep maintaining it because things outside of your control have changed? Do you enjoy this sort of thing if you do?
@Suki Yes - s/think/thank/ I'm doing it now, as you feel the need for it - and it's no less genuine for having been prompted, I assure you.
Faulty? Yes, once the parameter no longer worked with a current version of PHP. But, as I said, it's up to you whether or not to keep your mod up to date.
At no point have I complained that it was faulty, or didn't do what I wanted - when I found these things I did not ask you for anything, but made the corrections myself (imperfectly, but improved for me over the original), and what's more shared what I did for any one else to try or ignore as they please. I could have published my (now further improved) version, but I chose not to publish a mod that was simply a direct piggy-back off yours.
One difference between me and you (and other around here, it seems) is that in 44 years coding (yes, I am that old), while I like the satisfaction of doing something right, and also the satisfaction of seeing my code used, I have never looked for thanks other than from my employers.
Care to explain more details then? simply stating "doesn't work" or "stop working" is not really helpful.now i know the reason
Since you said the only thing that fixes it is reinstalling, I gotta say is not really a bug but its you messing around with your files, removing or changing things this mod needs, if that is the case, simply stopping doing it will solve your problem.
(http(?:s)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)
For those wanting to support both the "https" and the regular "http" URLs, I was able to get it to work by adding (?:s) after the http in the regex, so it looks like this:Code: [Select](http(?:s)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)
I think there has to be a ?: in there to make the "http|https" version work as well, but the "(?:s)" is shorter and accomplishes the same thing.
For those wanting to support both the "https" and the regular "http" URLs, I was able to get it to work by adding (?:s) after the http in the regex, so it looks like this:Code: [Select](http(?:s)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)
I think there has to be a ?: in there to make the "http|https" version work as well, but the "(?:s)" is shorter and accomplishes the same thing.
Fatal error: Call to undefined function OYTE_Who() in D:\WebPages\SMF-v2\Sources\Who.php on line 731Uninstalling doesn't clear this, but reinstalling an older version does - I think maybe this is a left-over problem that only occurs if the older version has been previously installed; I guess the uninstall misses something. Anyway, as a workaround, I just added back the OYTE_Who() function from the older version, and it resolved the issue for me.
Thanks for the update - the smiley correction in particular is much appreciated.
One comment: In the regex, you have added an option with ".+&" before the "v=" to allow a parameter before the video ID. However, in my system this needs to be ".+&" to work. As I don't know if this is always true, I have used ".+&(?:amp;)?" instead which seems fine.
Oh, and clicking the Admin menu item with this version installed gives me a fatal error:QuoteFatal error: Call to undefined function OYTE_Who() in D:\WebPages\SMF-v2\Sources\Who.php on line 731Uninstalling doesn't clear this, but installing an older version does - I think maybe this is a left-over problem that only occurs if the older version has been previously installed. Anyway, as a workaround, I just added back the OYTE_Who() function from the older version, and it resolved the issue.
[/youtube][youtube]
rather than [youtube][/youtube]
For those wanting to support both the "https" and the regular "http" URLs, I was able to get it to work by adding (?:s) after the http in the regex, so it looks like this:Code: [Select](http(?:s)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?)
I think there has to be a ?: in there to make the "http|https" version work as well, but the "(?:s)" is shorter and accomplishes the same thing.
Won't work unless you also change the $1 with $2 on this part: preg_replace($pattern, '$1', $data);
since with your change, $1 holds the "http" thing and not the ID, $2 holds the ID now.
Anyway, the mod has been updated:
1.1 - April 19, 2013,
- Fix the http/https url issue.
- Fixed the parsing smiles after a video issue.
- Fixed the pass by reference issue.
- Updated the regex to include more valid urls.
No support.
[youtube]<YouTube share link>[/youtube]
text in the WYSIWYG or bellow the comments box?
Also, the suggestion is NOTHING like my request, which specifically asks for a way to add text somewhere around the comments box.
I swear, this is what I get with the vast majority of open source project 'communities' now
and the forum mods tend to be perfectly happy to send off people looking for solutions
// Aeva Media changes
if (empty($parse_tags) && empty($context['uninstalling']))
{
global $sourcedir;
if (stripos($message, '[smg') !== false)
{
if (!function_exists('aeva_protect_bbc'))
require_once($sourcedir . '/Aeva-Subs.php');
aeva_protect_bbc($message);
}
// Protect noembed & autolink items from embedding *before* BBC parsing - wrap quotes, but don't protect
if (!empty($modSettings['aeva_enable']) && strlen($message) > 15)
{
if (!function_exists('aeva_preprotect'))
require_once($sourcedir . '/Aeva-Embed.php');
aeva_preprotect($message, $cache_id);
}
}
// End Aeva Media changes
// Ohara youtube embed
$message = OYTE_Preparse($message);
// Ohara youtube embed
$message = OYTE_Preparse($message);
// Aeva Media changes
if (empty($parse_tags) && empty($context['uninstalling']))
{
global $sourcedir;
if (stripos($message, '[smg') !== false)
{
if (!function_exists('aeva_protect_bbc'))
require_once($sourcedir . '/Aeva-Subs.php');
aeva_protect_bbc($message);
}
// Protect noembed & autolink items from embedding *before* BBC parsing - wrap quotes, but don't protect
if (!empty($modSettings['aeva_enable']) && strlen($message) > 15)
{
if (!function_exists('aeva_preprotect'))
require_once($sourcedir . '/Aeva-Embed.php');
aeva_preprotect($message, $cache_id);
}
}
// End Aeva Media changes
It seems the AEVA code interferes and somehow modifies the $message var so when that var gets passed to OYTE_Preparse() the tags has been already changed and so the checks this mod performs fails, easiest and dirtiest thing to do is just move this mod's code above the AEVA code:
On Sources/Subs.php find:Code: [Select]...
and replace with:Code: [Select]...
And I still don't think thats gonna solve the issue, I haven't installed AEVA in years so I don't know how exactly that mod works, just looking at the code, the call to aeva_preprotect($message, $cache_id); is the responsible for changing the message, appliying this code's changes before calling that function may r may not work, it all depends on what exactly aeva_preprotect($message, $cache_id); does.
http://youtu.be/bzw9hjmMbdA
http://www.youtube.com/watch?v=bzw9hjmMbdA
[url=http://youtu.be/bzw9hjmMbdA]http://youtu.be/bzw9hjmMbdA[/url]
[url=http://www.youtube.com/watch?v=bzw9hjmMbdA#ws]Ronda Rousey vs. Floyd Mayweather; Who Ya Got?[/url]
I'm sorry, I didn't understand your question.You are not the only one.
- If you have a custom theme you should follow Suki's screenshot
- You should check that the BBC is enabled in Administration » Posts and Topics » Bulletin Board Code
- Was the installation successfull in all steps or did it fail anything?
- Did you make any custom edits
- Mods installed?
- Error log clear or showing some errors related to this mod?
Maybe it was a bad download, removed and dl'd it . Reinstalled and it showed the tools to check the mod active and then was in the posting areas. So all is working thank you for the help.If you searched directly from your forum via package manager you should be reading this --> http://www.simplemachines.org/community/index.php?topic=521782.msg3691381#msg3691381
I'm having trouble installing this in 1 of my 3 forums. PHP ver 5.4 installed, SMF ver 2.0.7
All three forums are using the same themes and the mod works great in 2 of them.
But after I upload the file in the Pacakage Mgr in the 3rd forum, it wants FTP info in order to change file permissions while installing the mod.
This was not the case for the 1st 2 installs.
When I gave it the ftp info it changed my main folder permissions, crashed the forums (500 error) and my host helped me get it changed back. Installation failed.
So here's my question-
What files or folders need to have their permissions changed before installing the mod?
I can't seem to find anything different in the 3 forum folders.
Thanks
The issue is not within this mod anyway, you have some file permissions issues and installing any mod will give you the same results as this.
Make sure you have all the permissions required: http://wiki.simplemachines.org/smf/Installing#Set_File_and_Folder_Permissions
Also, about how to install this specific mod http://custom.simplemachines.org/mods/index.php?action=parse but click on your version first, unluckily the MOD site doesn't support links to specific version parsed instructions =_=
thanks for thatIt was not just rants. Can't you see it? Now I hope you did. No more questions regarding your mod so bye and thanks again :)
thanks a lot, it will be very useful when I will be linking instructions :D
$buttons[count($buttons) - 1][] = array(
'image' => 'youtube',
'code' => 'youtube',
'before' => '[youtube]',
'after' => '[/youtube]',
'description' => $txt['OYTE_desc'],
);
Code: [Select]$buttons[count($buttons) - 1][] = array(
'image' => 'youtube',
'code' => 'youtube',
'before' => '[youtube]',
'after' => '[/youtube]',
'description' => $txt['OYTE_desc'],
);
Make sure you have exactly that on your Sources/OharaYTEmbed.php file.
Do you have any other mod that modifies BBC? had you made any change to Sources/OharaYTEmbed.php ?
You can begin with what I already said:Code: [Select]$buttons[count($buttons) - 1][] = array(
'image' => 'youtube',
'code' => 'youtube',
'before' => '[youtube]',
'after' => '[/youtube]',
'description' => $txt['OYTE_desc'],
);
Make sure you have exactly that on your Sources/OharaYTEmbed.php file.
And also answering my questions:QuoteDo you have any other mod that modifies BBC? had you made any change to Sources/OharaYTEmbed.php ?
If you're using the WYSIWYG mode chances are thats the issue, it has all sorts of problems with it, sometimes the tag doens't show, sometimes it show backwards: [youtube][/youtube] etc. Unfortunately, I won't be fixing those issue as its just a big waste of time.
8: Undefined index: OYTE_unvalid_linkApply
/var/www/vhosts/mysite.com/Sources/OharaYTEmbed.php(60) : runtime-created function
Line: 5
* @version 1.1
It's actually doing it for both & and ? params. The ? only comes from the youtu.be share link
http://youtu.be/Fj4alwt0FgA?list=PL345B49A52C73B94E
Full link uses &
https://www.youtube.com/watch?v=Fj4alwt0FgA&list=PL345B49A52C73B94E
But also displays like the other:
http://www.final7fantasy.com/testforum/index.php/topic,1.0/message,92.html
http://www.final7fantasy.com/testforum/index.php/topic,1.0/message,94.html
Another with the playlist param:
http://www.final7fantasy.com/testforum/index.php/topic,1.0/message,95.html
Same thing for both, list=PL345B49A52C73B94E appears as text underneath the videos.
So for vimeo, where would I put this example URL in oharaYTEmbed.php:
<iframe src="//player.vimeo.com/video/71646438" width="500" height="281" style="border: none;"></iframe>
Thank you for being one of the few working embed mods left!
[quote]https://www.youtube.com/watch?v=g7cjDaOQpB0[/quote]
Use version 1.2, it has support for https
Make sure that the OharaYTEmbed.php file was indeed replaced with the one from version 1.2.
Then it has nothing to do with it having https it means the url you're trying to post is marked as invalid but not necessarily because it has https.
Post the complete url you're trying to use.
It parses just fine on my site and my test sites, again, you need to make sure you're indeed using version 1.2.
Ok, I implemented it, just keep in mind that it needs to have a full responsive theme, if you're theme is based on the default theme, this will not work properly.No problem as there exist a full responsive theme.
<div style="margin:auto; text-align:center;">
<div>
webkitallowfullscreen mozallowfullscreen
frameborder="0"
style="border: none;"
[spoiler][/spoiler]
If you have a test site, I can provide you with a beta of the next version, this package still contains the webkitallowfullscreen mozallowfullscreen but its a lot more easier to find and delete. I'm tempted to just remove that completely too.
As for videos inside tags, you could always use the normal youtube or vimeo tag for that, I can add a spoiler exception right in the middle of the auto-embed regex but that will cause more issues than anything and ultimately, people will start to ask for more exceptions.
[spoiler][youtube][/youtube][/spoiler]
[spoiler][youtube][/youtube][/spoiler]
[spoiler=inline][/spoiler]
Attention:
On install make sure to mark the "Install in Other Themes" checkbox.
If you didn't want to follow that then you will have to manually upload via FTp or similar the youtube and vimeo images to the bbc folder inside the images folder of whatever theme you're using.
[youtube]BpXMQ_S18iE[/youtube]
src="http://www.youtube.com/embed/$1"
src="http://www.youtube.com/embed/$1&vq=hd720"
Upon further investigation, it's an iframe in the older HTML embedding an HTML5 page that disables the full screen button. When the page returns the need to use Flash Player instead, full screen button shows.
[yotube]wifH74R3yJA[youtube]
but now with Ohara YouTube Embed this links aren't working.if (empty($data))
return sprintf($txt['OYTE_unvalid_link'], 'youtube');
// Did the user used the ID?
if (strlen($data) == 11)
return '<iframe width="'. (empty($modSettings['OYTE_video_width']) ? '420' : $modSettings['OYTE_video_width']) .'" height="'. (empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height']) .'" src="//www.youtube.com/embed/'. $data .'" frameborder="0"></iframe>';
My Youtube icon has disappeard from the bbc code for new posts.
Any suggestions? Using 2.0.4
Rick
My Youtube icon has disappeard from the bbc code for new posts.Is the icon just gone or are the words for it missing as well ?
Any suggestions? Using 2.0.4
Rick
Is the icon just gone or are the words for it missing as well ?
[youtube]myvideopath[/youtube]
Rick
RickQuoteIs the icon just gone or are the words for it missing as well ?
Updated and yes the icon and words are gone although the feature can still be used by hand.Code: [Select][youtube]myvideopath[/youtube]
Rick
Hey Suki,The problem still exists version 1.2.1
First off, thanks for the great work!
I have a question I hope you could help me with though. When I try to create a post with just a youtube video in it, I always receive the error message "message body was left empty".
(So I need to add extra characters or words to the message to be able to place it). Any ideas why this happens?
Thanks in advance!
Thanks for the update Suki! :)
Just wondering if:
" Added the option to disable the autoembed feature via $context['ohara_disable']."
relates to the SP shoutbox link issue I had a few days ago?
Hey Suki,The problem still exists version 1.2.1
First off, thanks for the great work!
I have a question I hope you could help me with though. When I try to create a post with just a youtube video in it, I always receive the error message "message body was left empty".
(So I need to add extra characters or words to the message to be able to place it). Any ideas why this happens?
Thanks in advance!
$context['aeva_disable'] = true;
$context['aeva_disable'] = true;
$context['ohara_disable'] = true;
http://guitaristguild.com/index.php?action=post;board=29.0
8: Undefined index: OYTE_vimeo_desc
File: /home1/camcra24/xxxxxx_xxx/Sources/OharaYTEmbed.php
Line: 107
Hi I'm having an issue with this modification on my website. Everything installed correctly and seems to work yet when a video is posted all that appears is the default grey youtube box with play button
HI,
I have the same problem as willy, thumbnail does show in some videos but not all, what css was copied from where to where?
What sddefault and hqdefault - where are these edits done?
Another issue is that i replaced this mod with my previous av lite which auto-embeds youtu.be links, going to every video on my forum to add the new youtube tags would be a pain.
How can i set it to autoembed youtu.be links?
Ah yet another thing to fix, thanks for the report.
Ah yet another thing to fix, thanks for the report.
No problem. I have another one now though,
Has youtube changed something? for some reason all my youtube vids no longer play. Shows the image, but no play button etc. Here's an example, http://guitaristguild.com/index.php?topic=727.0 pretty sure they were all working yesterday.
Using Ohara YouTube Embed 1.2.1
You need to click the video now!
You need to click the video now!
Thanks. Trouble is (on my site) they aren't clickable, at least not for me in Chrome IE11 or firefox. They work if I go directly on youtube though,
Could you please expand further on how to use the new added $context['ohara_disable'] to have the mod disabled in SP
Using the second part of the how to, you linked to (http://www.simplemachines.org/community/index.php?topic=227599.msg3753810#msg3753810) before doesn't seem to have the effect anymore with the new version :'(
edit;
It seems using http:// doesn't display but starting www. does?
Ah yet another thing to fix, thanks for the report.
No problem. I have another one now though,
Has youtube changed something? for some reason all my youtube vids no longer play. Shows the image, but no play button etc. Here's an example, http://guitaristguild.com/index.php?topic=727.0 pretty sure they were all working yesterday.
Using Ohara YouTube Embed 1.2.1
The mod absolutely needs this css file to work: http://guitaristguild.com/Themes/GrayStyle/css/oharaEmbed.css your site doesn't have it.
Get the mod, unzip it, get the css file and just upload that file to that path.
The mod absolutely needs this css file to work: http://guitaristguild.com/Themes/GrayStyle/css/oharaEmbed.css your site doesn't have it.
Get the mod, unzip it, get the css file and just upload that file to that path.
Thanks, not sure why it was missing, I checked the other themes on install. Anyway, uploaded and now have a play button, but still doesn't do anything. Does this mean I have something else missing?
The mod absolutely needs this css file to work: http://guitaristguild.com/Themes/GrayStyle/css/oharaEmbed.css your site doesn't have it.
Get the mod, unzip it, get the css file and just upload that file to that path.
Thanks, not sure why it was missing, I checked the other themes on install. Anyway, uploaded and now have a play button, but still doesn't do anything. Does this mean I have something else missing?
Yep, there is another issue, for some reason jquery is complaining about this bit:
$(document).on("click","#"+this.id,function(a) which is the click event that loads the actual video and plays it.
I suppose I will have to change it to a more friendly ID, will check this further today and get a fix for this alone with the other ones already reported.
[/quote]Could you please expand further on how to use the new added $context['ohara_disable'] to have the mod disabled in SP
Using the second part of the how to, you linked to (http://www.simplemachines.org/community/index.php?topic=227599.msg3753810#msg3753810) before doesn't seem to have the effect anymore with the new version :'(
edit;
It seems using http:// doesn't display but starting www. does?
It depends on the portal you are using, all $context['ohara_disable'] does is end up the function before the links gets parsed, it depends on whatever portal you are using to set $context['ohara_disable'] to true, this mod alone cannot "known" if you are using a portal or a shoutbox.
Keep in mind that $context['ohara_disable'] only works for the autoembed feature, normal videos posted using the youtube tags will not be affected by this.
I cannot understand your second question, display what exactly?
Sorry, I believe this is where someone before me found it hard to explain the situation..
I'll try my best :P
when you use a http://www.youtube.... link on a simple portal shoutbox and hit enter, .. the shoutbox refreshes as if you had posted but no post is actually posted/displayed/"shouted" but it does work (turns the YT link into [link] and doesn't wrap tags around with youtube links starting with www.
Taking a random shot, I'd guess it's a regex thing but I could be miles off O:)
Hopefully that makes sense! :-*
$result = '<div class="youtube" id="'. $videoID .'" style="width: '. (empty($modSettings['OYTE_video_width']) ? '420' : $modSettings['OYTE_video_width']) .'px; height: '. (empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height']) .'px;"></div>';
/*
Copyright (c) 2015 Jessica González
@license http://www.mozilla.org/MPL/MPL-1.1.html
*/
function oh_main(){$(".youtube").each(function(){videoID=this.id.replace("oh_","");imgsrc=oh_getImage(videoID);imgHeight=$(this).height();imgWidth=$(this).width();"undefined"!==typeof imgsrc&&$(this).css({"background-image":"url("+imgsrc+")","background-size":"cover"});$(this).append($("<div/>",{"class":"youtube_play"}));$("#oh_"+videoID).on("click",function(){var a="https://www.youtube.com/embed/"+videoID+"?autoplay=1&autohide=1";$(this).data("params")&&(a+="&"+$(this).data("params"));a=$("<iframe/>",
{frameborder:"0",src:a,width:imgWidth,height:imgHeight});$(this).replaceWith(a)})})}function oh_getImage(a){var b="",c,d,e=["maxresdefault","sddefault","mqdefault","hqdefault","default"];c=0;for(d=e.length;c<d&&(b="http://i.ytimg.com/vi/"+a+"/"+e[c]+".jpg",0==b.width);++c);return b}function oh_getUrl(a){var b=window.location.search.substring(1);if(-1<b.indexOf(a))return!0;for(var b=b.split(";"),c=0;c<b.length;c++)if(b[c].split("=")[0]==a)return!0}oh_main();
if(oh_getUrl("post"))$("input[name=preview]").on("click",function(){setTimeout(function(){oh_main()},3E3)});
@lurkalot Can you please do the following changes and test if that solves your issues?
On your Sources/OharaYTEmbed.php file
find this:Code: [Select]$result = '<div class="youtube" id="'. $videoID .'" style="width: '. (empty($modSettings['OYTE_video_width']) ? '420' : $modSettings['OYTE_video_width']) .'px; height: '. (empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height']) .'px;"></div>';
and replace with this:
$result = '<div class="youtube" id="oh_'. $videoID .'" style="width: '. (empty($modSettings['OYTE_video_width']) ? '420' : $modSettings['OYTE_video_width']) .'px; height: '. (empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height']) .'px;"></div>';
Now replace the entire Themes/default/scripts/ohyoutube.js file with this:Code: [Select]/*
Copyright (c) 2015 Jessica González
@license http://www.mozilla.org/MPL/MPL-1.1.html
*/
function oh_main(){$(".youtube").each(function(){videoID=this.id.replace("oh_","");imgsrc=oh_getImage(videoID);imgHeight=$(this).height();imgWidth=$(this).width();"undefined"!==typeof imgsrc&&$(this).css({"background-image":"url("+imgsrc+")","background-size":"cover"});$(this).append($("<div/>",{"class":"youtube_play"}));$("#oh_"+videoID).on("click",function(){var a="https://www.youtube.com/embed/"+videoID+"?autoplay=1&autohide=1";$(this).data("params")&&(a+="&"+$(this).data("params"));a=$("<iframe/>",
{frameborder:"0",src:a,width:imgWidth,height:imgHeight});$(this).replaceWith(a)})})}function oh_getImage(a){var b="",c,d,e=["maxresdefault","sddefault","mqdefault","hqdefault","default"];c=0;for(d=e.length;c<d&&(b="http://i.ytimg.com/vi/"+a+"/"+e[c]+".jpg",0==b.width);++c);return b}function oh_getUrl(a){var b=window.location.search.substring(1);if(-1<b.indexOf(a))return!0;for(var b=b.split(";"),c=0;c<b.length;c++)if(b[c].split("=")[0]==a)return!0}oh_main();
if(oh_getUrl("post"))$("input[name=preview]").on("click",function(){setTimeout(function(){oh_main()},3E3)});
Sorry, I believe this is where someone before me found it hard to explain the situation..
I'll try my best :P
when you use a http://www.youtube.... link on a simple portal shoutbox and hit enter, .. the shoutbox refreshes as if you had posted but no post is actually posted/displayed/"shouted" but it does work (turns the YT link into [link] and doesn't wrap tags around with youtube links starting with www.
Taking a random shot, I'd guess it's a regex thing but I could be miles off O:)
Hopefully that makes sense! :-*
Sorry I still cannot understand what you mean.
so, the mod works with www but not when using http://www ? is that what you are trying to say?
Can you post some screenshots of your problem?
@lurkalot Can you please do the following changes and test if that solves your issues?
On your Sources/OharaYTEmbed.php file
find this:Code: [Select]$result = '<div class="youtube" id="'. $videoID .'" style="width: '. (empty($modSettings['OYTE_video_width']) ? '420' : $modSettings['OYTE_video_width']) .'px; height: '. (empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height']) .'px;"></div>';
and replace with this:
$result = '<div class="youtube" id="oh_'. $videoID .'" style="width: '. (empty($modSettings['OYTE_video_width']) ? '420' : $modSettings['OYTE_video_width']) .'px; height: '. (empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height']) .'px;"></div>';
Now replace the entire Themes/default/scripts/ohyoutube.js file with this:Code: [Select]/*
Copyright (c) 2015 Jessica González
@license http://www.mozilla.org/MPL/MPL-1.1.html
*/
function oh_main(){$(".youtube").each(function(){videoID=this.id.replace("oh_","");imgsrc=oh_getImage(videoID);imgHeight=$(this).height();imgWidth=$(this).width();"undefined"!==typeof imgsrc&&$(this).css({"background-image":"url("+imgsrc+")","background-size":"cover"});$(this).append($("<div/>",{"class":"youtube_play"}));$("#oh_"+videoID).on("click",function(){var a="https://www.youtube.com/embed/"+videoID+"?autoplay=1&autohide=1";$(this).data("params")&&(a+="&"+$(this).data("params"));a=$("<iframe/>",
{frameborder:"0",src:a,width:imgWidth,height:imgHeight});$(this).replaceWith(a)})})}function oh_getImage(a){var b="",c,d,e=["maxresdefault","sddefault","mqdefault","hqdefault","default"];c=0;for(d=e.length;c<d&&(b="http://i.ytimg.com/vi/"+a+"/"+e[c]+".jpg",0==b.width);++c);return b}function oh_getUrl(a){var b=window.location.search.substring(1);if(-1<b.indexOf(a))return!0;for(var b=b.split(";"),c=0;c<b.length;c++)if(b[c].split("=")[0]==a)return!0}oh_main();
if(oh_getUrl("post"))$("input[name=preview]").on("click",function(){setTimeout(function(){oh_main()},3E3)});
Suki, thanks, done the edits, but all I'm getting is a black box where the video should be, and although it looks clickable it doesn't do anything.
Sorry, I believe this is where someone before me found it hard to explain the situation..
I'll try my best :P
when you use a http://www.youtube.... link on a simple portal shoutbox and hit enter, .. the shoutbox refreshes as if you had posted but no post is actually posted/displayed/"shouted" but it does work (turns the YT link into [link] and doesn't wrap tags around with youtube links starting with www.
Taking a random shot, I'd guess it's a regex thing but I could be miles off O:)
Hopefully that makes sense! :-*
Sorry I still cannot understand what you mean.
so, the mod works with www but not when using http://www ? is that what you are trying to say?
Can you post some screenshots of your problem?
Correct.
using an address beginning with http://www doesn't work.
(I've actually since reverted to the old version of Ohara YT Embed since it seemed to do everything I needed (with the changes for SP shoutbox applied))
Something is preventing the ohyoutube.js file from executing, can be a jquery conflict or other js error somewhere. Does it happens with all embedded videos?
Can you disable the sharethis mod and see if that helps?
Sorry, I can't reproduce it anymore as I've reverted to the older version etc.
(Glad I even have a functional site at after todays events, So I probably won't try updating for a while but that's another story lol!)
If you've a test site; simple portal (with shoutbox) and Ohara .. You should be able to reproduce it if you'd like to have a look..
Installed both mods did the edit on Subs-Portal.php, set up a shoutbox and pasted the different links, thats all I did.
I seem to be getting an error in the log each time I click the new topic button, or reply button. Using the latest version Ohara YouTube Embed 1.2.1 And the tooltip is missing from the vimeo bbc button.Code: [Select]http://guitaristguild.com/index.php?action=post;board=29.0
8: Undefined index: OYTE_vimeo_desc
File: /home1/camcra24/xxxxxx_xxx/Sources/OharaYTEmbed.php
Line: 107
/*
Copyright (c) 2015 Jessica González
@license http://www.mozilla.org/MPL/MPL-1.1.html
*/
function oh_main(){
$('.youtube').each(function() {
var videoID = this.id.replace('oh_',''),
imgsrc = oh_getImage(videoID),
imgHeight = $(this).height(),
imgWidth = $(this).width();
if (typeof imgsrc !== 'undefined'){
$(this).css({'background-image': 'url('+ imgsrc +')', 'background-size': 'cover'});
}
$(this).append($('<div/>', {'class': 'youtube_play'}));
$('#oh_'+videoID).on('click', function() {
var iframe_url = 'https://www.youtube.com/embed/' + videoID + '?autoplay=1&autohide=1';
if ($(this).data('params')) iframe_url+='&'+$(this).data('params');
// The height and width of the iFrame should be the same as parent
var iframe = $('<iframe/>', {'frameborder': '0', 'src': iframe_url, 'width': imgWidth, 'height': imgHeight })
// Replace the YouTube thumbnail with YouTube HTML5 Player
$(this).replaceWith(iframe);
});
});
};
function oh_getImage(youtubeID)
{
var imgsrc = '',
index, len,
imageTypes = ['hqdefault', 'mqdefault', 'sddefault', 'maxresdefault'];
for (index = 0, len = imageTypes.length; index < len; ++index) {
imgsrc = 'http://i.ytimg.com/vi/'+ youtubeID +'/'+ imageTypes[index] +'.jpg';
if (imgsrc.width !=0){
break;
}
}
// Still no image, show the default one
if (imgsrc.width ==0){
imgsrc = 'http://i.ytimg.com/vi/'+ youtubeID +'/default.jpg';
}
return imgsrc;
};
function oh_getUrl(sParam)
{
var sPageURL = window.location.search.substring(1);
// SimpleSEF or pretty urls?
if (sPageURL.indexOf(sParam) > -1) {
return true;
}
var sURLVariables = sPageURL.split(';');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return true;
}
}
return false;
}
function oh_refresh()
{
setTimeout(function(){oh_main()},3E3);
}
$(function(){
oh_main();
if (oh_getUrl('post'))
$('input[name=preview]').on('click',function(){
oh_refresh();
});
});
// Someone else might not like this!
if (empty($message) || !empty($context['ohara_disable']))
return $message;
if (empty($context['current_topic']))
return $message;
// The extremely long regex...
Suki, sorry for not coming back to you on this sooner. Like I mentioned earlier, I was going to rebuild the site, which I've now done, fresh files etc. Still testing a few things out, but your mod worked fine as it was. I tested it after installing each mod.
Today I noticed it's stopped working again. ???
So thanks I'll give your edit a go and report back.
420connect.info
If your problem is the same as mine.
Solution:
http://www.smf.pl/index.php/topic,12124.msg60188.html#msg60188
OharaYTEmbed.php
It should look something like this.Code: [Select]// Someone else might not like this!
if (empty($message) || !empty($context['ohara_disable']))
return $message;
if (empty($context['current_topic']))
return $message;
// The extremely long regex...
I am not the author
can you please test it to see if this also fixes your issue?
OK, the produced div on the page you linked to still shows an ID without the oh_ prefix:
id="yIQGH4aQWI0"
Make sure that your Sources/OharaYTEmbed.php file has this exactly line of code:
$result = '<div class="youtube" id="oh_'. $videoID .'" style="width: '. (empty($modSettings['OYTE_video_width']) ? '420' : $modSettings['OYTE_video_width']) .'px; height: '. (empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height']) .'px;"></div>';
Notice the id="oh_'. $videoID .'" part which have the oh_ prefix
Your file should look exactly like this one: https://github.com/MissAllSunday/OharaYouTubeEmbed/blob/1.2/Sources/OharaYTEmbed.php
OK, the produced div on the page you linked to still shows an ID without the oh_ prefix:
id="yIQGH4aQWI0"
Make sure that your Sources/OharaYTEmbed.php file has this exactly line of code:
$result = '<div class="youtube" id="oh_'. $videoID .'" style="width: '. (empty($modSettings['OYTE_video_width']) ? '420' : $modSettings['OYTE_video_width']) .'px; height: '. (empty($modSettings['OYTE_video_height']) ? '315' : $modSettings['OYTE_video_height']) .'px;"></div>';
Notice the id="oh_'. $videoID .'" part which have the oh_ prefix
Your file should look exactly like this one: https://github.com/MissAllSunday/OharaYouTubeEmbed/blob/1.2/Sources/OharaYTEmbed.php
Yep it was missing that part. Actually, Just downloaded your mod again and checked it, and it's also missing from that file.
Edit: Added the missing code and it's working again. ;)
Thats because the current download doesn't have that code or any of the js code either, you are basically testing the new version which will have that code by default.
Do you have a link where I can see an example? did you tried doing the edits I mentioned before?
[youtube]http://youtu.be/BOGOMIzl7Nk[/youtube]
Tight!
[url=https://youtu.be/BOGOMIzl7Nk]Link[/url], in case that video doesn't play.
I really need a link to a post with a youtube video.
A link where I can see this?Link to my forum is here: http://forum.energydrinkdiscussions.com/index.php?topic=6.0 (http://forum.energydrinkdiscussions.com/index.php?topic=6.0)
Most likely you do not have the oharaEmbed.css css file in whatever theme you are using, that file needs to be located at:
/Themes/your_theme/css/oharaEmbed.css
where your_theme is the actual name of the theme you are using.
The topic or board you are looking for appears to be either missing or off limits to you.
Please login below or register an account with Energy Drink Discussions.
A lot of people seem to have server issues who install this mod. Permissions are set to 0755 fold and 0644 files.
I don't have time to quote all of the people in this thread who also have the same 500 error. I mentioned the permissions because that seems to be the solution to all the other problems people have with this mod. Just thought I'd save time.
<link rel="stylesheet" type="text/css" href="'. $settings['theme_url'] .'/css/oharaEmbed.css" />
<link rel="stylesheet" type="text/css" href="'. $settings['default_theme_url'] .'/css/oharaEmbed.css" />
Try the solution IU gave a couple of messages ago.
Replace the entire Themes/default/scripts/ohyoutube.js with this:
Make sure that your Sources/OharaYTEmbed.php file has this exactly line of code:
[html]
<p> <iframe width="560" height="315" src="https://www.youtube.com/embed/lbG4ryrsb6w?showinfo=0" frameborder="0" allowfullscreen></iframe> </p>
<p>HUNG HOM, Hong Kong - Hiding under the stairs in the shopping district, in a venue actually called Under the Staircase Shop, works Sister May, who carries on her family's tradition of hand making mahjong tiles in her nestled workshop Kam Fat Mahjong at 2 Bulkeley Street.</p>
<!-- <p><a href="http://www.womenofchina.cn/womenofchina/html1/news/newsmakers/1504/1476-1.htm"><em><img style="float: left;" src="images/stories/various/readmore.png" alt="readmore" /></em></a></p>
<p> </p> -->
[/html][cutoff]
[youtube]https://youtu.be/lbG4ryrsb6w[/youtube]
@SDMiller Do you have a link where I can see this behavior?
... and I still get the same black box which doesn't play on posts using the ohara button, as seen in this (http://mahjong.us.com/forum/index.php?topic=350.msg489#msg489) example.
I see where the error is, the .css file only gets uploaded to the default theme but the code is using $settings['theme_url'] which will try to use the current installed theme and not the default one :(
I'll release a fix for this later. In the meantime you can try this:
Open your Sources/OharaYTEmbed.php and find this:Code: [Select]<link rel="stylesheet" type="text/css" href="'. $settings['theme_url'] .'/css/oharaEmbed.css" />
And replace it with this:Code: [Select]<link rel="stylesheet" type="text/css" href="'. $settings['default_theme_url'] .'/css/oharaEmbed.css" />
@SDMiller Try the solution listed here:Open your Sources/OharaYTEmbed.php and find this:Code: [Select]<link rel="stylesheet" type="text/css" href="'. $settings['theme_url'] .'/css/oharaEmbed.css" />
And replace it with this:Code: [Select]<link rel="stylesheet" type="text/css" href="'. $settings['default_theme_url'] .'/css/oharaEmbed.css" />
Replace the entire Themes/default/scripts/ohyoutube.js with this:
Make sure that your Sources/OharaYTEmbed.php file has this exactly line of code:
<link rel="stylesheet" type="text/css" href="'. $settings['default_theme_url'] .'/css/oharaEmbed.css" />
[/quote]
@FLEXjs Funny, that function OYTE_Who() is form an old Ohara version, the current version doesn't use that function anymore. That indicates that you might have multiple installs of different versions of this mod.
find all instances of this:
$(
and change it for this:
jQuery(
/*
╩Copyright (c) 2015 Jessica Gonzçlez
╩@license http://www.mozilla.org/MPL/MPL-1.1.html
*/
function oh_main(){
jQuery('.youtube').each(function() {
var videoID = this.id.replace('oh_',''),
imgsrc = oh_getImage(videoID),
imgHeight = jQuery(this).height(),
imgWidth = jQuery(this).width();
if (typeof imgsrc !== 'undefined'){
jQuery(this).css({'background-image': 'url('+ imgsrc +')', 'background-size': 'cover'});
}
jQuery(this).append(jQuery('<div/>', {'class': 'youtube_play'}));
jQuery('#oh_'+videoID).on('click', function() {
var iframe_url = 'https://www.youtube.com/embed/' + videoID + '?autoplay=1&autohide=1';
if (jQuery(this).data('params')) iframe_url+='&'+jQuery(this).data('params');
// The height and width of the iFrame should be the same as parent
var iframe = jQuery('<iframe/>', {'frameborder': '0', 'src': iframe_url, 'width': imgWidth, 'height': imgHeight })
// Replace the YouTube thumbnail with YouTube HTML5 Player
jQuery(this).replaceWith(iframe);
});
});
};
function oh_getImage(youtubeID)
{
var imgsrc = '',
index, len,
imageTypes = ['hqdefault', 'mqdefault', 'sddefault', 'maxresdefault'];
for (index = 0, len = imageTypes.length; index < len; ++index) {
imgsrc = 'http://i.ytimg.com/vi/'+ youtubeID +'/'+ imageTypes[index] +'.jpg';
if (imgsrc.width !=0){
break;
}
}
// Still no image, show the default one
if (imgsrc.width ==0){
imgsrc = 'http://i.ytimg.com/vi/'+ youtubeID +'/default.jpg';
}
return imgsrc;
};
function oh_getUrl(sParam)
{
var sPageURL = window.location.search.substring(1);
// SimpleSEF or pretty urls?
if (sPageURL.indexOf(sParam) > -1) {
return true;
}
var sURLVariables = sPageURL.split(';');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return true;
}
}
return false;
}
function oh_refresh()
{
setTimeout(function(){oh_main()},3E3);
}
jQuery(function(){
oh_main();
if (oh_getUrl('post'))
jQuery('input[name=preview]').on('click',function(){
oh_refresh();
});
});
@FLEXjs Funny, that function OYTE_Who() is form an old Ohara version, the current version doesn't use that function anymore. That indicates that you might have multiple installs of different versions of this mod.
@SDMiller the glossary mod you have has a very outdated version of jquery that may prevent this mod form working properly.
Now it looks like some other mod added jquery and its using its "no conflict" features which means that the var this mod uses to reference jquery no longer works: $
Can you do another manual fix? besides all the other fixes, open your Themes/default/scripts/ohyoutube.js
find all instances of this:
$(
and change it for this:
jQuery(
First, do you support (or plan on adding support for) extremely short tags? [youtube]{ID}[/youtube] (I'm using Karl's Youtube Mod on Hogville and need to replace it. Trying to not go the Aeva route.)
Second, does your mod intelligently handle SSL vs non SSL requests?
Third, do you have any plans on adding Vine support? I've manually added the Vine player/app onto Hogville (see this thread); can provide you with the needed info to embed Vine, as well, if you want (hit me up via PM).
Do you have a "pretty urls" mod installed? admin/index.php is not a vanilla SMF url.
Is it only the admin panel? for some reason this mod likes to annoy crappy hostings by setting files to 777 which some host may see as "too much" and inmediatly show a 500 error. Reverting the permissions to the file solves the issue.
You are using another mod which uses jquery with "jQuery" as the variable name, this mod (and SMF 2.1 too) uses "$".
You need to either change the other mod to use $ or replace all instance of $ with jQuery on the Themes/default/scripts/ohyoutube.min.js file file.
Suki, I was using Aeva for all pics and videos. Youtube obviously stopped allowing this. I loaded your mod, and the links changed to black boxes. I even disable Aeva, and still only get boxes. If I drop the "s" from https, Aeva works fine, but don't feel like editing 1000's of old posts. Is Aeva causing a conflict?
Suki, I was using Aeva for all pics and videos. Youtube obviously stopped allowing this. I loaded your mod, and the links changed to black boxes. I even disable Aeva, and still only get boxes. If I drop the "s" from https, Aeva works fine, but don't feel like editing 1000's of old posts. Is Aeva causing a conflict?
Well, nope, I didn't recommend censoring anything :P
The page you showed me its showing videos just fine using aeva, meaning you're not really using this mod, actually it seems you are no longer using this mod.
Open your /Sources/OharaYTEmbed.php file and find 2 instances of this:Code: [Select]src="http://www.youtube.com/embed/$1"
Change both of them to this:Code: [Select]src="http://www.youtube.com/embed/$1&vq=hd720"
You are using another mod which uses jquery with "jQuery" as the variable name, this mod (and SMF 2.1 too) uses "$".
You need to either change the other mod to use $ or replace all instance of $ with jQuery on the Themes/default/scripts/ohyoutube.min.js file file.
Actually, having this creates a lot of issues, specially when viewing a topic on a really large screen. This bit of css matches the whole size of the screen, meaning that you will end up with a video as large as the actual screen, that looks pretty weird on desktops... I know it shouldn't be an issue on smaller screens but for desktop ones it really feels rather weird having a huge video screen.
Using css @media will sove this but then again I no longer trust $context['html_headers'] since mod authors use it wrongly so this will be implemented only on the version compatible with SMF 2.1. Will post simple instructions for people who still want to have this.
Using css @media will sove this but then again I no longer trust $context['html_headers'] since mod authors use it wrongly so this will be implemented only on the version compatible with SMF 2.1. Will post simple instructions for people who still want to have this.
@420connect.info can you please test this new version? it does include support for responsive videos and a few other fixes Do note that this will only work if you have a responsive theme, the default curve theme or any other variant of it will not work.
I tested this with the Responsive Curve mod and works well with it.
Heres the changelog:
1.2.4 - August 2, 2015,
- Added responsiveness to videos. This will only work on responsive themes.
- Fixed an issue when two or more instances of the same video where posted, none of them would be played.
- Re-wrote the JS code to use prototypes.
- Change the default size values to 480 x 270.
<script type="text/javascript">!window.jQuery && document.write(unescape(\'%3Cscript src="//code.jquery.com/jquery-1.9.1.min.js"%3E%3C/script%3E\'))</script>
in OharaYTEmbed.php fails while validating the XHTML ;)character "&" is the first character of a delimiter but occurred as data
<script type="text/javascript">
//<![CDATA[
!window.jQuery && document.write(unescape(\'%3Cscript src="//code.jquery.com/jquery-1.9.1.min.js"%3E%3C/script%3E\'))
//]]>
</script>
And the file gets called correctly, not sure if from the same mod, but since it's 1.9.1 version I think it is this mod, as I don't recall of any other mod I have using 1.9.1 (I could be very wrong at this, I am running 140 mods, please bear with me :D). Gonna have a second look later on.
Babism, I've merged your topic with the mod support topic, as this is where you need to ask questions when you have an issue with a mod :).thank you Irisado
[02-Jan-2016 15:32:28 Africa/Abidjan] PHP Warning: Cannot modify header information - headers already sent in /home3/***/public_html/sith/Sources/Errors.php on line 346
[02-Jan-2016 21:25:49 Africa/Abidjan] PHP Fatal error: Call to undefined function OYTE_Preparse() in /home3/***/public_html/sith/Sources/Subs.php on line 928
I really want to use this mod for the gifv support, but I already have thousands of posts on the forum that use the Aeva embed.
With Aeva you just pasted the youtube url and would embed, is this possible with this mod too? (So I can remove aeva and only use this mod)
(I don't want the two mods conflicting, would rather use one mod)
Ideally I can embed youtube automatically, and gifv with [] tags. Then I would switch to this mod instantly ;D
This modification can automatically embed YouTube videos from just inserting their links. You can also use [youtube][/youtube] tags as well, but they are optional.My bad!I really want to use this mod for the gifv support, but I already have thousands of posts on the forum that use the Aeva embed.
With Aeva you just pasted the youtube url and would embed, is this possible with this mod too? (So I can remove aeva and only use this mod)
(I don't want the two mods conflicting, would rather use one mod)
Ideally I can embed youtube automatically, and gifv with [] tags. Then I would switch to this mod instantly ;D
I managed to fix it, something went wrong during installation..Bug: Gifv's are not working on mobile... :( (iPhone)
New question: How do I stop the "preload" image, I just want the normal youtube embed.New question #2: How do I left align the videos? (they are centered now)Fixed in CSS
Its gonna be tricky, theres a whole silly thing with browsers supporting only their preferred formats, besides I don't own any apple product so its going to be difficult to debug this.Does it work on Android for you?
I s till haven't test it, my site is running SMF 2.1 and I have a totally different mod version for that SMF version only and I still haven't properly update it, onces I got it solved I will be able to test it on Android although since most people uses chrome it will have the same disadvantages every other chrome browser has.Should I update to 2.1 then?
No, you shouldn't upgrade to 2.1 just for this.
I'm aware of that bug, unfortunately it is more than just "removing everything after the &" as not all urls follows that format, when I change the regex I gotta make sure it will work for the url formats I support.
Don't use the censor feature as that will only increase the server burden.
The issue is related to special chars such as - and _ on the urls and not with the url format itself. Will release a new version to add support for those chars.
As for old youtube links, make sure they aren't surrounded by any BBC tags, this particular url is a standard one supported by the mod already.
When an url doesn't get automatically embeded it almost always means there is another bbc tag on them, this mod automatically skips urls inside bbc tags.
Also, bear in mind that it will be almost impossible to caught every single youtube url out there, things like time elapse, time starting and any other special youtube params will most likely not be supported.
[url=http://www.youtube.com/watch?v=0sTTGlqZDx0]http://www.youtube.com/watch?v=0sTTGlqZDx0[/url]
the url BCC tag? As all my old youtube links have this :/
Its just a matter of adding this:
$context['ohara_disable'] = true;
Before the call to your shoutbox, but it depends on how you are adding your shoutbox, if its a php block or a pre-made one, if its a premade one then you will have to modify simpleportal code to add that code just before the shoutbox messages are being parsed via parse_bbc()
$context['aeva_disable'] = true;
$context['aeva_disable'] = true;
$context['ohara_disable'] = true;
I'm having some issues with the mod-- it detects my YouTube URLs and tries to replace them, but only builds black boxes instead of video embeds. Screenshot attached.
Any idea what I did wrong? I'm on v.2.0.11 and downloaded the mod today.
var $m = jQuery;
var _oh=function(){this.masterDiv=$m(".oharaEmbed");this.basedElement=this.masterDiv.parent();this.defaultWidth="undefined"!==typeof _ohWidth?_ohWidth:480;this.defaultHeight="undefined"!==typeof _ohHeight?_ohHeight:270;this.aspectRatio=this.defaultHeight/this.defaultWidth;this.main();this.responsive()};
_oh.prototype.main=function(){$this=this;$m(".youtube").each(function(){var b=this.id.replace("oh_",""),a=$this.getImage(b),c=$this.basedElement.height(),d=$this.basedElement.width();"undefined"!==typeof a&&$m(this).css({"background-image":"url("+a+")","background-size":"cover"});$m(this).append($m("<div/>",{"class":"youtube_play"}));$m(this).one("click",function(){var a="//www.youtube.com/embed/"+b+"?autoplay=1&autohide=1";$m(this).data("params")&&(a+="&"+$m(this).data("params"));a=$m("<iframe/>",{frameborder:"0",
src:a,width:d,height:c});$m(this).css({"background-image":"none"}).append(a);$m(this).children(".youtube_play").css({height:"0"});$this.responsive()})})};_oh.prototype.responsive=function(){$this=this;$m(window).resize(function(){var b=$this.basedElement.width(),a=b*$this.aspectRatio<=$this.defaultHeight?b*$this.aspectRatio:$this.defaultHeight,c=b<=$this.defaultWidth,d=c?b:$this.defaultWidth,e=c?a:$this.defaultHeight;$this.masterDiv.width(d).height(e);$m(".oharaEmbed > iframe").each(function(){$m(this).width(d).height(e)})}).resize()};
_oh.prototype.refresh=function(){$this=this;setTimeout(function(){$this.main()},3E3);setTimeout(function(){$this.responsive()},3E3)};_oh.prototype.getImage=function(b){var a="",c,d,e=["hqdefault","mqdefault","sddefault","maxresdefault"];c=0;for(d=e.length;c<d&&(a="//i.ytimg.com/vi/"+b+"/"+e[c]+".jpg",0==a.width);++c);0==a.width&&(a="//i.ytimg.com/vi/"+b+"/default.jpg");return a};(function(b){b(function(){var a=new _oh;b("input[name=preview]").on("click",function(){a.refresh()})})})(jQuery);
Edit, apparently you have removed my copyright link from your credits page, while thats completely legal, I reserve my right to provide support for those who had removed my copyright.
Hi,
Your mod installed beautifully into 2.0.11 default with the package manager and works just fine; thanks so much! I wanted to ask if an edit will allow the video to be viewed fullscreen? I searched this thread and did see where one user achieved it but the section of code he/she specified doesn't seem to appear in the files inside the zip and I didn't want to break anything, since I am not proficient in file editing. I thought it might be wiser to come here and simply ask, if you don't mind?
Thank you. :)
if (applyWidth <= 0 && applyHeight <= 0) {
applyWidth = $this.defaultWidth;
applyHeight = $this.defaultHeight;
}
Goodevening
i installed the mod,is working great but it gives me
that when i press "reply"
I dont know if i should ask here or on my theme support forum.
Has anyone face that?
Hi Suki,
Thanks for this fantastic mod !
I only have a small problem with the videosize.
The preview picture of the embedded video shows up correctly in the topic.
Bud then it starts playing an i only see 1/4 th of the video.
I see the top-left part of it...
Then when i double-click the video it becomes full screen and when i close
the full screen then it shows the correct size inside the box in the topic.
Why is this happening ?
Can i do something about it ?
Thanks in advance for your reply...
Luc
SMF2.0.11
Yes, it happens with all video's
Even video's like movietrailers give the same result.
If you can watch again now i put a trailermovie in the same topic as imagine...
So any movie from youtube results in partial viewing...
No other youtube mod is installed...
Thanks
Luc
I just tested the mod and it works just fine : missallsunday.com/test/index.php?topic=12.0
how are you embedding it? whats the url you're trying to use?
I just tested the mod and it works just fine : missallsunday.com/test/index.php?topic=12.0
how are you embedding it? whats the url you're trying to use?
http://i.imgur.com/srjx6wP.gifv
Just like that, the url.
What could be wrong?
Yeah, it seems the mod is correctly parsing the gifv but for some reason it isn't displayed by the browser, I have no idea why.So what do I do now? :|
http://i.imgur.com/B9jtcKt.gifv Failed to load resource: the server responded with a status of 404 (Unknown Error)When you click those, they redirect to a .gifv file, just like the one that actually displays on the site.
http://i.imgur.com/XBS7kaV.webm Failed to load resource: the server responded with a status of 404 (Unknown Error)
http://i.imgur.com/pWuVUn7.webm Failed to load resource: the server responded with a status of 404 (Unknown Error)
http://i.imgur.com/xbg5ivQ.webm Failed to load resource: the server responded with a status of 404 (Unknown Error)
http://i.imgur.com/IFEbJaE.webm Failed to load resource: the server responded with a status of 404 (Unknown Error)
http://i.imgur.com/BLqj1nc.webm Failed to load resource: the server responded with a status of 404 (Unknown Error)
http://i.imgur.com/2tS7WAS.webm Failed to load resource: the server responded with a status of 404 (Unknown Error)
http://i.imgur.com/mG6BofC.webm Failed to load resource: the server responded with a status of 404 (Unknown Error)
http://i.imgur.com/nBrxkAi.webm Failed to load resource: the server responded with a status of 404 (Unknown Error)
http://i.imgur.com/qOSi48F.webm Failed to load resource: the server responded with a status of 404 (Unknown Error)
Ca you post alink to a specific post where this is happening?
@coltp45, @Rock Lee theres seems to be an issue with non-responsive themes, can you replace your /Themes/default/scripts/ohyoutube.min.js file with the one I'm attaching to see if the changes I made fixes this issues?
Be sure to clean your browsers cache or do a hard refresh (Control + F5)
var _oh=function(){this.masterDiv=$(".oharaEmbed");this.basedElement=this.masterDiv.parent();this.defaultWidth="undefined"!==typeof _ohWidth?_ohWidth:480;this.defaultHeight="undefined"!==typeof _ohHeight?_ohHeight:270;this.aspectRatio=this.defaultHeight/this.defaultWidth;this.basedWidth=this.basedElement.width()>=this.defaultWidth?this.defaultWidth:this.basedElement.width();this.basedHeight=this.basedElement.height()>=this.defaultHeight?this.defaultHeight:this.basedElement.height();this.main();this.responsive()};
<script type="text/javascript" src="'. $settings['default_theme_url'] .'/scripts/ohyoutube.min.js"></script>
<script type="text/javascript" src="'. $settings['default_theme_url'] .'/scripts/ohyoutube.js"></script>
For those of you interested, I've been updating this mod to work and use some of the new features SMF 2.1 offers, so far this is the result. Attached is a beta of this mod for SMF 2.1, the new features include:
// Let's see if there's still some content left without the tags.
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><iframe><div><iframe><div>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '[html]') === false))
$post_errors[] = 'no_message';
<file name="$sourcedir/Post.php">
<operation>
<search position="replace"><![CDATA[<img>]]></search>
<add><![CDATA[<img><iframe><div>]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[<img>]]></search>
<add><![CDATA[<img><iframe><div>]]></add>
</operation>
</file>
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img>')) === '')
{
$post_errors[] = 'no_message';
unset($_POST['message']);
Yes, thats something I'm aware of, will check when I have some time. Tracked (https://github.com/MissAllSunday/OharaYouTubeEmbed/issues/9) in the meantime.sawweeet. thanks
In Sources/OharaYTEmbed.php find:but i dont see that line anymore? how can i align the videos on the left? also for whatever reasons, imgur video (gifv) are not working for me .. not on chrome or firefox - not sure if you have any thoughts
<div style="text-align:center;margin:auto;padding:5px;" class="youtube $1">
and replace with:
<div style="text-align:left;margin:auto;padding:5px;" class="youtube $1">
Do you have some urls examples using the m.youtube format?yes here you go
to make style changes, the mod adds its own .css file named oharaEmbed.css the class you need to change is .oharaEmbed
Try this one and let me know if m.youtube urls works. Just replace your file on Sources with the attached one.awesome!!! it works now!
Also, do you have some examples of imgur gifv urls to test on?
Spoke too soon. Yes the m.YouTube works now but it broke the regular YouTube videosTry this one and let me know if m.youtube urls works. Just replace your file on Sources with the attached one.awesome!!! it works now!
Also, do you have some examples of imgur gifv urls to test on?
here are an example of the gifv urls
http://i.imgur.com/vGo06wk.gifv
http://i.imgur.com/QAkHEy6.gifv
but for some reasons, i think its my theme that messing with this.. but if you can take a look to see if its the mod
btw i am single , if you are looking for a husband
can you post examples of the broken urls?the url directly
Are you posting simple links our using the youtube tag?
Try this one, I made some changes to the way gifv are posted but for some reasons some examples just don't play at all, it returns a 404 code when trying to embed them, must be some config at imgur or something.
A new version has been released:do i have to do that as well? or that file you gave included those changes?
1.2.8 - Oct 25, 2016
- Improve regex for gifv and youtube urls.
- Pass the ID when using url auto parsing, prevents using another regex to get it.
- Use global scope inside closures..
To upgrade just uninstall any previous version and install the new one and don't forget to check the "Install in Other Themes" checkboxes for all your installed themes.
A new version has been released:
1.2.8 - Oct 25, 2016
- Improve regex for gifv and youtube urls.
- Pass the ID when using url auto parsing, prevents using another regex to get it.
- Use global scope inside closures..
To upgrade just uninstall any previous version and install the new one and don't forget to check the "Install in Other Themes" checkboxes for all your installed themes.
There's no real way to fix the imgur gifv, some of them simply do not play at all, I don't know if there's a setting to avoid embed on external sites.
I'll look at the height and width
function OYTE_Gifv($data)
{
global $modSettings, $txt;
loadLanguage('OharaYTEmbed');
// Gotta respect the master setting...
if (empty($data) || empty($modSettings['OYTE_master']))
return sprintf($txt['OYTE_unvalid_link'], 'gifv');
// Set a local var for laziness.
$videoID = '';
$result = '';
// We all love Regex.
$pattern = '/^(?:https?:\/\/)?(?:www\.)?i\.imgur\.com\/([a-z0-9]+)\.gifv/i';
// First attempt, pure regex.
if (empty($videoID) && preg_match($pattern, $data, $matches))
$videoID = isset($matches[1]) ? $matches[1] : false;
// At this point, all tests had miserably failed.
if (empty($videoID))
return sprintf($txt['OYTE_unvalid_link'], 'gifv');
// Got something!
else
$result = '<video style="max-width: 945px;" autoplay="" loop="" muted="" preload="" class="imgurgifvVid">
<source src="//i.imgur.com/'. $videoID .'.webm" type="video/webm">
<source src="//i.imgur.com/'. $videoID .'.mp4" type="video/mp4">
</video>';
return $result;
}
/* 2016/11/10
Pulseczar/puzzlecars/Alex O. did this ****** */
function OYTE_Gifv($data)
{
global $modSettings, $txt;
loadLanguage('OharaYTEmbed');
// Gotta respect the master setting...
if (empty($data) || empty($modSettings['OYTE_master']))
return sprintf($txt['OYTE_unvalid_link'], 'gifv');
// Set a local var for laziness.
$videoID = '';
$result = '';
$identifier = '';
// We all love Regex.
$imgurPattern = '/^(?:https?:\/\/)?(?:www\.)?i\.imgur\.com\/([a-z0-9]+)\.gifv/i';
$gfycatPattern = '/^(?:https?:\/\/)?(?:.+)?(?:gfycat\.com)\/(.+?)(?:\.[^.]*$|$)/i';
// First attempt, pure regex. Imgur
if (empty($videoID) && preg_match($imgurPattern, $data, $matches))
$videoID = isset($matches[1]) ? $matches[1] : false;
if(!empty($videoID))
{
$result = '
<div class="video-container">
<video style="max-width: 945px;" loop="" muted="" preload="" class="imgurgifvVid"
onmousedown="if (!this.controls && event.button == 0) { if (this.paused) { this.play(); } else { this.pause(); }}">
<source src="//i.imgur.com/'. $videoID .'.webm" type="video/webm">
<source src="//i.imgur.com/'. $videoID .'.mp4" type="video/mp4">
</video>
<div style="font-size: 75%; font-style: italic; padding: 0px; margin: -2px 0px 2px 0px;">Click to Play</div>
</div> ';
return $result;
}
// gfycat
if (empty($identifier) && preg_match($gfycatPattern, $data, $matches))
{
$identifier = isset($matches[1]) ? $matches[1] : false;
}
if(!empty($identifier))
{
$result = '
<div class="video-container">
<video preload="auto" muted="muted" loop="loop" poster="http://thumbs.gfycat.com/'.$identifier.'-poster.jpg" style="height: auto; max-width: 100%;" onmousedown="if (!this.controls && event.button == 0) { if (this.paused) { this.play(); } else { this.pause(); }}">
<source src="http://zippy.gfycat.com/'.$identifier.'.webm" type="video/webm" />
<source src="http://zippy.gfycat.com/'.$identifier.'.mp4" type="video/mp4" />
<source src="http://fat.gfycat.com/'.$identifier.'.webm" type="video/webm" />
<source src="http://fat.gfycat.com/'.$identifier.'.mp4" type="video/mp4" />
<source src="http://giant.gfycat.com/'.$identifier.'.webm" type="video/webm" />
<source src="http://giant.gfycat.com/'.$identifier.'.mp4" type="video/mp4" />
<a href="http://gfycat.com/'.$identifier.'">[ View Video ]</a>
</video>
<div style="font-size: 75%; font-style: italic; padding: 0px; margin: -2px 0px 2px 0px;">Click to Play</div>
</div> ';
return $result;
}
// At this point, all tests had miserably failed.
return sprintf($txt['OYTE_unvalid_link'], 'gifv');
}
And this works for both Imgur and Gfycat and makes them click to play:Code: [Select]/* 2016/11/10
Pulseczar/puzzlecars/Alex O. did this ****** */
function OYTE_Gifv($data)
{
global $modSettings, $txt;
loadLanguage('OharaYTEmbed');
// Gotta respect the master setting...
if (empty($data) || empty($modSettings['OYTE_master']))
return sprintf($txt['OYTE_unvalid_link'], 'gifv');
// Set a local var for laziness.
$videoID = '';
$result = '';
$identifier = '';
// We all love Regex.
$imgurPattern = '/^(?:https?:\/\/)?(?:www\.)?i\.imgur\.com\/([a-z0-9]+)\.gifv/i';
$gfycatPattern = '/^(?:https?:\/\/)?(?:.+)?(?:gfycat\.com)\/(.+?)(?:\.[^.]*$|$)/i';
// First attempt, pure regex. Imgur
if (empty($videoID) && preg_match($imgurPattern, $data, $matches))
$videoID = isset($matches[1]) ? $matches[1] : false;
if(!empty($videoID))
{
$result = '
<div class="video-container">
<video style="max-width: 945px;" loop="" muted="" preload="" class="imgurgifvVid"
onmousedown="if (!this.controls && event.button == 0) { if (this.paused) { this.play(); } else { this.pause(); }}">
<source src="//i.imgur.com/'. $videoID .'.webm" type="video/webm">
<source src="//i.imgur.com/'. $videoID .'.mp4" type="video/mp4">
</video>
<div style="font-size: 75%; font-style: italic; padding: 0px; margin: -2px 0px 2px 0px;">Click to Play</div>
</div> ';
return $result;
}
// gfycat
if (empty($identifier) && preg_match($gfycatPattern, $data, $matches))
{
$identifier = isset($matches[1]) ? $matches[1] : false;
}
if(!empty($identifier))
{
$result = '
<div class="video-container">
<video preload="auto" muted="muted" loop="loop" poster="http://thumbs.gfycat.com/'.$identifier.'-poster.jpg" style="height: auto; max-width: 100%;" onmousedown="if (!this.controls && event.button == 0) { if (this.paused) { this.play(); } else { this.pause(); }}">
<source src="http://zippy.gfycat.com/'.$identifier.'.webm" type="video/webm" />
<source src="http://zippy.gfycat.com/'.$identifier.'.mp4" type="video/mp4" />
<source src="http://fat.gfycat.com/'.$identifier.'.webm" type="video/webm" />
<source src="http://fat.gfycat.com/'.$identifier.'.mp4" type="video/mp4" />
<source src="http://giant.gfycat.com/'.$identifier.'.webm" type="video/webm" />
<source src="http://giant.gfycat.com/'.$identifier.'.mp4" type="video/mp4" />
<a href="http://gfycat.com/'.$identifier.'">[ View Video ]</a>
</video>
<div style="font-size: 75%; font-style: italic; padding: 0px; margin: -2px 0px 2px 0px;">Click to Play</div>
</div> ';
return $result;
}
// At this point, all tests had miserably failed.
return sprintf($txt['OYTE_unvalid_link'], 'gifv');
}
It at least works with the [gifv] tag. I haven't tried auto-embed.
You are using another mod which uses jquery with "jQuery" as the variable name, this mod (and SMF 2.1 too) uses "$".
You need to either change the other mod to use $ or replace all instance of $ with jQuery on the Themes/default/scripts/ohyoutube.min.js file file.
'description' => $txt['youtube']
$context['bbc_tags'][] = array(
array(
'image' => 'youtube',
'code' => 'youtube',
'before' => '[youtube]',
'after' => '[/youtube]',
'description' => $txt['youtube']
),
array(
'image' => 'jwp',
'code' => 'jwp',
'before' => '[jwp=425,344,image]',
'after' => '[/jwp]',
'description' => $txt['jwplayer']
),
This mod does not use that $txt string and it doesn't make any edit to that file. It seems you are using another youtube mod.
Description
For SMF 2.0.x only
Version 1.2.x and above requires PHP 5.3 or greater
if (version_compare(PHP_VERSION, '5.3.0', '<'))
exit('This mod needs PHP 5.3 or greater. You will not be able to install/use this mod, contact your host and ask for a php upgrade.');
Thank you for all the information - I know you do a lot of work on mods here. I was annoyed at Kindreds attitude (as usual).;D
how do you end up breaking your installation except by choosing to ignore a warning that was put there for a good reason?
How do you end up with a host that has a version of PHP that is nearly 10 years old?Possibly most of them, if not all, considering people can't be bothered to follow php insane development speeds, having to rewrite their softwares every 2 years. If you are, smf 2.1 is on GitHub, feel free to go ahead and recode it to be php 7.0+ compatible :) (and no don't ask me to do so myself, I couldn't, whereas you could).
follow php insane development speeds, having to rewrite their softwares every 2 years.
ETA: Is this the jQuery issue you mentioned back in 2015?
I am not sure where to put the files from the download. I am using Go Daddy. Sorry about being a newb, I am not much of a coder. I do understand some things.
Thanks
I’m lacking the option in this modification, thanks to which it is possible to set place of film because originally is imposed showing film in the middle.That can be done adding in your index.css:
.oharaEmbed{
display: inline-block;
}
Then, it will behave like any text, and you can add the alignment BBCodes to put the video in the left, center or right side.I’m lacking the option, thanks to which it is possible to turn off the vimeo and imgur tag. Should be choice.That is in the Admin Panel > Post Settings > BBC. Here you can choose what BBCodes to turn OFF.
I’m lacking in this modification showing the title right on the top of film before turn it on. Such like this is in the Yet Another YouTube BBCode Tag modification.I can argue that I installed this because that other MODs didn't do the thing well for me, so having this doing the same as the others means that will cause that this MOD also didn't work well (aesthetically) for me. The variety of doing the same but not looking exactly the same is why some MODs are similar but still each one have different uses.
I think that taking the example from the other modification isn't bad.
What's the point of making two mods do the same things?
Do you have a link to a topic where this happens?
You may want to update your Chrome or something, it's fine here.
.oharaEmbed {
margin-left: auto ;
margin-right: auto ;
text-align:center;
background-position: center;
background-repeat: no-repeat;
background-color: #000;
overflow: hidden;
transition: all 200ms ease-out;
cursor: pointer;
}
display: inline-block;
[center]https://www.youtube.com/watch?v=ehjJ614QfeM[/center]
[center][youtube]https://www.youtube.com/watch?v=ehjJ614QfeM[/youtube][/center]
I can click the video just fine as a guest using Vivaldi 1.14.
The mod largely depends on JS to render the videos, it might be the case that some js are only rendered for registered suers and that theres an error on that js, preventing this mod from showing the videos correctly.
Try loading that page as a guest and see if theres any difference.
Can you open chrome dev tools and see if theres any js error showing when displaying a page with a video on it?
ohyoutube.min.js:8 Uncaught TypeError: $ is not a function
at HTMLDivElement.<anonymous> (ohyoutube.min.js:8)
at HTMLDivElement.d (jquery.min.js:3)
at HTMLDivElement.dispatch (jquery.min.js:3)
at HTMLDivElement.r.handle (jquery.min.js:3)
Yes, most likely theres another mod adding/using jquery, you will need to list all the mods that are using it and remove them one by one to know which one is causing the conflict.
https://www.youthhockeyinfo.com/index.php/topic,335.html
<iframe src="//www.youtube.com/embed/FIeSFyV2tsI?autoplay=1&autohide=1" frameborder="0" allowfullscreen="allowfullscreen" style="width: 480px; height: 270px;"></iframe>
Just trying this on test forum, 2.0.15 Curve. Video loads, but click play button it scrolls up and get black screen. Video plays normally on youtube. Showing this code -Code: [Select]
<iframe src="//www.youtube.com/embed/FIeSFyV2tsI?autoplay=1&autohide=1" frameborder="0" allowfullscreen="allowfullscreen" style="width: 480px; height: 270px;"></iframe>
You can see it here (http://www.thekrashsite.com/smf20/index.php?topic=29.msg176#msg176)
<script type="text/javascript">!window.jQuery && document.write(unescape(\'%3Cscript src="//code.jquery.com/jquery-1.9.1.min.js"%3E%3C/script%3E\'))</script>
Would it be possible at all to modify this mod to playback Dailymotion videos on my site?
Let me report that the W3C validator shows warnings (see attached screenie) which are probably related to
line 659 in OharaYTEmbed.phpCode: [Select]<script type="text/javascript">!window.jQuery && document.write(unescape(\'%3Cscript src="//code.jquery.com/jquery-1.9.1.min.js"%3E%3C/script%3E\'))</script>
For SMF 2.0.x only
Version 1.2.x and above requires PHP 5.3 or greater
For SMF 2.0.x only
Version 1.2.x and above requires PHP 5.3 or greater
Hello!
SMF 2.0.15 + Ohara YouTube Embed 1.2.9 on PHP 5.6 mod work.
PHP 7.0 mod does not work. On-screen text Youtube: "An error occurred. Please try again later (playback ID=...)"
Please, help?
@jsx and @FishingManMatt thank you for your translations, can you also provide a non-utf8 file?
Hi jsx, your OharaYTEmbed.polish.php file looks kinda weird. For it to be valid, it needs to be encoded in the same encoding the Polish translation uses, right now, notepad++ detects the file as just "ANSI". This means that any special character won't be displayed correctly for users that aren't using the UTF8 Polish language.
According to wikipedia, Polish uses Windows-1250 so thats the encoding I'm going to use for that file and hope nothing gets too borked.
Check your browser console for any JS error or provide a link to your forum where a video is suppose to load, dummy credentials if its for members only, and I will take a look at it.
Check your browser console for any JS error or provide a link to your forum where a video is suppose to load, dummy credentials if its for members only, and I will take a look at it.
for twitter this type of mod???? since when did twitter become youtube?
Hi jsx,
Try [noembed] [/noembed] around the video's url.
Will have to look at it to see how this mod behaves with the option.
Hi,
Seeing a problem with this mod on 2.0.16, mainly apparently when people use the "recent posts" function.
https://...../index.php?action=recent
8: Undefined index: airp_attachments
File: ...../Themes/default/languages/OharaYTEmbed.english-utf8.php (main sub template - eval?)
Line: 55
Any suggestions please?
Thanks,
- Rob
Hi,
Seeing a problem with this mod on 2.0.16, mainly apparently when people use the "recent posts" function.
https://...../index.php?action=recent
8: Undefined index: airp_attachments
File: ...../Themes/default/languages/OharaYTEmbed.english-utf8.php (main sub template - eval?)
Line: 55
Any suggestions please?
Thanks,
- Rob
The issue most likely is with another mod, this mod uses hooks which means its files as loaded after the main ones. The way the error log tries to catch on which file the error is suppose to appear can be confused when a mod loads its own files via hooks.
On your mod list check if theres one with the prefix: "airp_". Thats the mod with the issue, most likely some txt language var wasn't found.
@Suki
In Features and Options > Signatures > Enabled BBC tags
I turned off the use of youtube tags in the signature, but the embedded video is displayed in the signature. Why is this happening?
Will have to look at it to see how this mod behaves with the option.
I'm trying to replicate the issue on a fresh 2.0.17 install but the forum indeed prevents me from saving a signature with disallowed tags.
Keep in mind this restriction does not apply to forum admins. Meaning you as an admin can use all tags regardless of their restrictions.
2e1a6a28246536b775a6b5b4e48c83d9
Indefinite
1x https://tryhackx.org/index.php?action=moderate;area=postmod;sa=posts
4x https://tryhackx.org/index.php?
1x https://tryhackx.org/index.php?https://tryhackx.org/
2x https://tryhackx.org/index.php?action=forum
8: Undefined index: image
File: /home/tryhackxbf/www/Themes/default/languages/OharaYTEmbed.polish.php (body_above sub template - eval?)
Line: 246
2.0.17
+
I have bugs in subs-post.php + subs.php with this same hash 2e1a6a28246536b775a6b5b4e48c83d9
(https://s6.ifotos.pl/img/123123123_qanqxrn.png)
The issue most likely is with another mod, this mod uses hooks which means its files as loaded after the main ones. The way the error log tries to catch on which file the error is suppose to appear can be confused when a mod loads its own files via hooks.
On your mod list check if theres one with the prefix: "airp_". Thats the mod with the issue, most likely some txt language var wasn't found.
That's right, but if in the modification settings feature is enabled "Enable the autoembed feature" then the video will be displayed in the signature despite the fact that it is prohibited in the BBC tag settings. Features and Options > Signatures > youtube/yt - Check it out, and you'll see.
The auto embed is for @jsx
@dodos26 Your issue lies with another mod, this mod uses hooks and requires files on runtime which makes the SMF log error confused about where exactly the error is, if you can, uninstall this mod to see where the real error is.
Oh you mean the auto-embed, yeah I don't think there's a good way to solve that unfortunately. Might require some more edits when saving the signature. Good place to place a hook on 2.1, will check it out.
.oharaEmbed {
text-align:center;
background-position: center;
background-repeat: no-repeat;
background-color: #000;
overflow: hidden;
transition: all 200ms ease-out;
cursor: pointer;
ve tried to install the mod with my fresh forum 2.0.17 but not success.
I installed the mode by link the url in admin panel. The mode appeared on the page but when click install there was a message showed unable to find a file.
Then I also manually install (not download the package this time) by changing the code for 2.0.17 in source/post.php and source/sub.php
what happened was when save after edit source/post.php all normal (no change)
after save source/sub.php, page blank and error message came up.
Then I changed the source/sub.php back to previous codes. Now the forum back to normal again.
I tried installed the mod again with url in control panel then did replace new code and same problem happened.
How did you installed the first time? via the packager manager? do you have a custom theme installed? define "not success" does the mod failed to install? did it get installed but no menu? did it get installed but the BBC button didn't appear?2.0.17 default theme.Yes via package manager. I copied the mod address then paste on admin control panel>download new package> url but left" name the file" blank. After download,the mod appeared in the list normally. But after click install, the forum showed message "no filename or cannot find file name" so I click "back". I think it was installed. After that I started the manual install by changing the code as I explained above.
Can you try downloading the zip file to your computer and upload it via the packager manager?I downloaded the zip file to my computer and tried to install it. then message below.
mmm I also have issues with installing a zip file I created with Ubuntu 18.04. Perhaps it is the way it was compressed. Can someone else make a quick test to see if you can install the mod using the latest zip I uploaded?I just tried i got the same error as here
Alright, made a new zip file with p7zip hopefully this one won't cause any issues, dunno why the one generated by archive manager caused issues :/Yes i tested this and it uploaded and installed fine no errors.
Should be, yes.Can you post a screenshot from a mobile device what YouTube looks like?
<script type="text/javascript" src="', $settings['theme_url'], '/scripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="', $settings['theme_url'], '/code.jquery.com/jquery-3.5.1.min.js"></script>
<file name="$sourcedir/Post.php">
<operation>
<search position="replace"><, '<img>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '[html]') === false))]]></search>
<add><, '<img><iframe><video><div>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '[html]') === false))]]></add>
</operation>
<operation>
<search position="replace"><, '<img>')) === '')]]></search>
<add><, '<img><iframe><video><div>')) === '')]]></add>
</operation>
</file>
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><object><embed>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '[html]') === false))
andif ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><object><embed>')) === '')
ok, is there a way by chance to set perms or limit use by admin and mods ?from my understand, no....as it's a bbcode anyone can use it....you can hide it from the bbcode list, but still anyone that knows the code (which they could get from quoting a post that has it) could just type it in and be able to use it to embed youtube videos....