When you post an URL, AutoLinks automatically:
Video sites currently supported:
You can also force an URL to become a clickable link (rather than becoming embedded) by putting a '!' at the beginning of the URL. For example, !http://www.example.com/video/1 will be a clickable link and won't embed video in the page.
Change log is available here.
I am happy to add support for other video sites to this plugin. If you want another site supported, just ask (or post a patch!).
This plugin will work for any formatters that properly call their child formatters. Currently, this includes the default text formatter and the HTML formatter. The Markdown formatter doesn't, but it can easily be modified to work (see comment #3 below for instructions).
The code for this plugin was based on the MakeItSimpleFormatter. I re-wrote it to play nicely with other formatters, display links differently and so that I could apply some of the changes requested.
Other Requirements (if any):
Uploaded version 1.0 of AutoLinks.
Uploaded version 1.1 of AutoLinks.
edam
To get AutoLinks to work nicely with the Markdown Formatter, you need to also have the HTML Foramtter installed and you need to modify both the Markdown Formatter and the HTML Formatter. I will give full instructions below, but...
If you just want a get it working, you can download an already-modified versions of the Markdown Formatter 1.1.2 and the HTML Formatter 2.4 from here and here.
If you would rather make the modifications manually, here are the steps involved.
First, you need to get the Markdown Formatter to honour it's child formatters and accept HTML (which it should, as per the Markdown spec., but doesn't by default). This can be done with the following patch:--- default.php.orig 2009-03-13 15:57:59.000000000 +0000<br />+++ default.php 2009-03-19 15:10:45.000000000 +0000<br />@@ -17,13 +17,21 @@<br /> class MarkdownFormatter extends StringFormatter {<br /> function Parse($String, $Object, $FormatPurpose) {<br /> if ($FormatPurpose == FORMAT_STRING_FOR_DISPLAY) {<br />- $String = $this->ProtectString($String);<br />- return Markdown($String);<br />+ $String = $this->ParseChildren($String, $Object, $FormatPurpose);<br />+ if( isset( $Object->Context->StringManipulator->Formatters[ "Html" ] ) ) {<br />+ $String = Markdown( $String );<br />+ $String = $Object->Context->StringManipulator->Formatters[ "Html" ]->Execute( $String, true );<br />+ }<br />+ else {<br />+ $String = $this->EscapeHtml( $String );<br />+ $String = Markdown( $String );<br />+ }<br />+ return $String;<br /> } else {<br /> return $String;<br /> }<br /> }<br />- function ProtectString ($String) {<br />+ function EscapeHtml ($String) {<br /> //$String = str_replace("<", "<", $String);<br /> // $String = str_replace(">", ">", $String);<br /> $String = explode("\n", $String);<br />
Second, you need to modify the HTML Formatter to allow the Markdown formatter to use it's parsing abilities. The following patch will achieve this:--- default.php.orig 2009-03-19 13:02:20.000000000 +0000<br />+++ default.php 2009-03-19 13:04:46.000000000 +0000<br />@@ -111,7 +111,7 @@<br /> $this->TagArray = &$GLOBALS['Html_TagArray'];<br /> }<br /><br />- function Execute($String)<br />+ function Execute($String, $ParseOnly)<br /> {<br /> $this->TagArray = array('normal' => array(), 'extraclosing' => array());<br /> $String = str_replace(chr(0), ' ', $String);<br />@@ -172,7 +172,7 @@<br /> $sReturn<br /> );<br /><br />- if(HTML_CONVERT_NEWLINES)<br />+ if(HTML_CONVERT_NEWLINES && !$ParseOnly)<br /> $sReturn = str_replace(<br /> array("\r\n", "\r", "\n"),<br /> '<br />',<br />@@ -389,7 +389,7 @@<br /><br /> function Parse($String, $Object, $FormatPurpose)<br /> {<br />- if($FormatPurpose == FORMAT_STRING_FOR_DISPLAY) $sReturn = $this->Execute($String);<br />+ if($FormatPurpose == FORMAT_STRING_FOR_DISPLAY) $sReturn = $this->Execute($String, false);<br /> else $sReturn = $String;<br /><br /> return $this->ParseChildren($sReturn, $Object, $FormatPurpose);
Finally, you need to allow the "embed" tag through the HTML Formatter (which is disallowed by default). To achieve this, you need to remove 'embed' from the list of disallowed tags on line 76 in HTML Formatter's default.php. The following patch will achieve this:--- default.php.orig 2009-03-19 13:02:20.000000000 +0000<br />+++ default.php 2009-03-19 13:45:16.000000000 +0000<br />@@ -73,7 +73,7 @@<br /><br /> //which tags should simply be removed (be warned, most of these are here because they are not safe<br /> //enough to allow/clean, remove at your own risk)<br />-$Html_DisallowedTags = array('link', 'iframe', 'frame', 'frameset', 'object', 'param', 'embed', 'style',<br />+$Html_DisallowedTags = array('link', 'iframe', 'frame', 'frameset', 'object', 'param', 'style',<br /> 'applet', 'meta', 'layer', 'import', 'xml', 'script', 'body', 'html', 'head', 'title', 'ilayer');<br /><br /> //don't parse anything in these tags
Any problems with these instructions, just let me know!
you might not have noticed this:
http://lussumo.com/addons/index.php?PostBackAction=AddOn&AddOnID=434
It can support anything you want and works on the server, client side or both.
good job. but I need support for Attachments 2.1 (image or mpeg or flv..). please??
This seems to be PHP5 only because of the use of stripos() so i added a bit of code before the start of the class so that it becomes php4 and php5 compatible.
if (!function_exists('stripos')) {
function stripos($haystack, $needle){
return strpos($haystack, stristr( $haystack, $needle ));
}
}
does it support metacafe.com video?
i found that it doesn't support metacafe
Uploaded version 1.2 of AutoLinks.
edam version 1.2:
@kelvin: you say you "need support for Attachments 2.1", what do you mean exactly? If you want mpg/flv attachments to display in-line, I think you should ask in the Inline Images 1.3 extension, or the Attachments 2.1 extension. The AutoLinks extension is only really for turning links in to embedded content.
thanks for the metacafe.
this is just superb plugin!! i appreciate!
could you please tell me how to add url w/ mp3 player. i'd like to provide listening inside the topic but file's address as well.
This is one of the greatest Vanilla plugins ever invented. Thank you Edam!
The other greatest Vanilla plugin never invented is BlogThis by Spode...now if only they could work together we could blow this joint.
Forgive my stupid question but what do you mean by AutoLinks?
This is extension is HOT! Thank you.
Uploaded version 1.3 of AutoLinks.
edam version 1.3:
@Bentot: I thought "AutoLinks" sounds like it'll automatically create links. This doesn't really explain the embedding though... :o)
Can anyone think of any obvious video sites that aren't supported?
I guess it means image and YouTube links will automatically display :)
I love this extension. I wish someone will find a way to create one like Google video/audio chat
Now I will make you responsible to rewrite it for Vanila2. :)
Raize, you mentioned using AutoLinks and BlogThis. I'm using both of those addons, too, but AutoLinks doesn't seem to do anything for BlogThis. Example: rewild.info. Has anybody gotten these two to work together? Any ideas on how I might accomplish that? I'm not adverse to modifying some source code if need be, but any insight you can offer is much appreciated.
edam Hmm, these two extension *should* work together. I'll look in to why they aren't...
Version number changed from 1.3 to 1.4.
Uploaded version 1.4 of AutoLinks.
edam version 1.4:
@jefgodesky, @Raize: there you go! :o)
Thank you! Works great!
Thanks for this plugin! It is great.
I'd like to know -if possible- if there is a way to use it by linking a thumbnail to a larger image as opposed to just creating a text hyperlink. Right now I can modify the text/url and make it an anchor text via the wiki plugin as autolink does not offer this text add-on. I would also like to know if there is a way to automagically embed FLVs files into a comment. I know auotlink supports specific video sites like youtube and similar but want to know if in the future dropping an FLV url will get converted into a flash movie inside a comment.
rayk Does this work with FCKeditor? For some reason I paste a youtube url and it doesn't turn it into embedded video. Thanks
Ultra-cool - works perfectly with YouTube! (on a plain Vanilla forum editor)
edam @usor: I don't think I can make AutoLinks automatically embed flash, like it does with images, because, unlike images, the width and height of the flash object would need to be specified when embedding it. (Someone please correct me if I'm wrong!). What you could do though, if you have the HTML Formatter addon, is embed the flash object manually with HTML. As for thumbnails - I like the idea. I'll have to give some thought as to how you'd specify that you wanted a thumbnail rather than a text link or an embedded image. If you've got any ideas, feel free to post them!
@rayk: I'll look in to this when I've got a moment.
alexdc How difficult would be convert this addon into Vanila2?
edam I don't know. V2 works very differently to V1, so it'll take a small amount of work (though it's not a complicated addon). I was going to take a look at it sometime and port it.
The mailto: function doesn't seem to be enabled on my installation. Plus, it appears that http:// must be before the hyperlink in order to make it active. Am I correct? Please see here for this problem: http://postyouradlinkfree.info/comments.php?DiscussionID=55&page=1#Item_2
woot woot
anyway you could implement FAIRTILIZER embeds? Right now it really doesnt work because it takes me to the fairtilizer site sans the side panel that has the music player in it, so I cant even link to the fairtilizer site to hear the music.
many thanks!
edam @jasonrocks7: I couldn't see you using any mailto: links, but you literally have to type, "mailto:someone@example.com" for it to work. And yes, you are correct, links that begin "http://" (or "https://", etc) are automatically made in to links. If this weren't the case, the extension might make some things that aren't links in to links.
edam version 1.5
@banjanqrum: there you go. Don't forget to allow the 'iframe' HTML tag through if you use the HtmlFormatter with the above modifications. You do this by removing it from the $Html_DisallowedTags list, in the same way as you do the 'embed' tag (see the end of the instructions on modifying HTML Formatter manually).
I'm sorry, but it doesn't work. I'm using Vanilla 1.1.9 and added Autolink 1.5 and the modified Markdown 1.12 form here http://www.waxworlds.org/forum/extensions/Markdown-2006-03-15-2007-03-152-modified.zip
When I activate Markdown and switch my comment from text mode to markdown mode, all videos disapear.
Hi, I'm having the same issue. I'm not getting it to work and I'm using Vanilla 1.1.8. Any ideas?
edam @mkadi, @swisswebmiss: Ok, sorry for the delay. I've figured out what's causing the problem you're having. Try disabling and re-enabling the AutoLinks extension and that should fix it.
It's because Vanilla runs the extensions in the order they were enabled and AutoLinks adds it's self as a child formatter of any formatters that exist at the time it runs. If the HTML or Markdown formatter extensions haven't been run at that point, they won't exist. So AutoLinks has to be enabled last. I'll look at converting AutoLinks in to a global formatter instead, which should fix it properly.
ken524 @edam,
This extension is exactly what we've been looking for.
Is it possible to limit the length of displayed URL links? If someone enters a really long URL it would be cool if only 50 characters or so were displayed and end with "..." like:
http://cgi.ebay.com/ebaymotors/ws/eBayISAPI.dll?Vi...
Thanks!
ken524 I just solved my own problem... If anyone is interested in doing what I posted above, I modified this extension as follows:
I replaced line 132: return '<a href="'.$link[0].'" rel="nofollow" class="auto-embedded" >'.$link[0].'</a>';
With the following:<br /> $linkDisplay = $link[0];<br /> if (strlen($linkDisplay) > 50) {<br /> $linkDisplay = substr($linkDisplay,0,50) ;<br /> $linkDisplay = $linkDisplay."...";<br /> }<br /> return '<a href="'.$link[0].'" rel="nofollow" class="auto-embedded" target="_blank">'.$linkDisplay.'</a>';<br />
The code does two things. First, it limits the display length of URL's to 50 characters (or whatever you set it to). Second, I added target="_blank" to the anchor tag so the link will open a new tab (my preference when viewing a forum).
Hope this helps someone else!
Hello there.
anyone here can make Autolink replace .FLV link to embed obj code?
Can you add support for blip.tv?
pls fix AutoLink to work in Blogthis addon.
edam @ken524: that's a good idea! I'll add it to the next release. Thanks!
@Bers40k: If you (or anyone else) can suggest a free flash flv player on the web that I can use (or even include?), then I'll happily add this feature.
@MacTyler: I looked in to that. I don't think that it's possible. They have deliberately made their embedding URLs different to their video links, probably to try and avoid automatic embedding.
@Bers40k: I'll have another look at BlogThis, see if I can get them to work together. In the mean time, try disabling and re-enabling the AutoLinks extension. I realised a while ago that it has be enabled last, or it is unable to hook in to the other extensions!
http://vanillaforums.org/profile/7530/edam
> free flash flv player on the web that
may be this http://flv-mp3.com/ru/ ?
> and re-enabling the AutoLinks extension
i try but AL dont work
this works well except for one thing...
when i type (http://mydomainurl.com) it doesn't recognize it as a link unless i put spaces between the URL and parenthesis
in regards to the above... somehow that worked in this forum but not in my vanilla version 1.
I get this at the top of the page after posting a link; how does one fix it?
Deprecated: Function split() is deprecated in /home/ooveecom/public_html/forum/extensions/AutoLinks/default.php on line 140
Deprecated: Function split() is deprecated in /home/ooveecom/public_html/forum/extensions/AutoLinks/default.php on line 142
Addons are custom features that you can add to your Vanilla forum. Addons are created by our community of developers and people like you!
We review addons to make sure they are safe and don't cause bugs. An addon is considered to be "Vanilla Approved" once our review process is complete.