You can easily add auto-conversion of html links as follows:
1. Add: $sReturn = $this->AutoLink($sReturn); Above: return $sReturn; in function Execute()
2. Add (code taken from the Extended Text Formatter): function AutoLink($String) {
$String = str_replace(array(""","&"),array('"','&'),$String);
$String = preg_replace(
"/
(?<!<a href=\")
(?<!\")(?<!\">)
((https?|ftp):\/\/)
([\@a-z0-9\x21\x23-\x27\x2a-\x2e\x3a\x3b\/;\x3f-\x7a\x7e\x3d]+)
/msxi",
"<a href=\"$0\" target=\"_blank\" rel=\"nofollow\">$0</a>",
$String);
return $String;
}
Between the Execute function and the VideoLink function.
its a simple matter to have the radio button be selected by default if instead of text, however, I looked on the addon code and cant find where the radio buttons are created.. maybe someone with addon creation experience can help us out
ah right, now that i think about it, it does do that... so unless you want to turn off text formatter, or absolutely need it to be html default first time, it should be best as is
I'm trying to set a discussion format from the Janine extension. I'm using this code:
$Configuration['JanineDiscFormat'] = 'HTML';
Everything else works, but the posts still end up in text format and I have to manually change them.
Any help on how to get Html as the format on an automatically created post?
well it'd be nice if I could tell what this 'janine' extension did without having to go look it up, but assuming it has something to do with setting the formatter type, I think you'd want 'Html' (note the cases).
Janine is an extension to automatically create a new Vanilla discussion and associate it with a post on a blog. Right now Janine only supports recent versions of WordPress, but in theory it could be easily extended to work with just about any blog or content management system.
I actually did try "Html" as well, in case it was case sensitive, but the same thing resulted.
Well, how stupid. I tried lower case again, just in case, and it worked. Something else was wrong last time I tested and I guess I never tried lower-case again with the other fixes. Thanks.
Is there a way that scripts can only be added by the admin but viewed by all. or a way to have safe javascript like the one from google that allows embedding of google gadgets in ur webpage.
Hi folks. I've a found a solution to something which was bugging me since a while: YouTube videos keep a white background. His this is quite ugly on a non-white background, but there's an easy fix.
Replace this, at line 122: case 'youtube' : return ('<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'.$ID.'"></param>'.
'<embed src="http://www.youtube.com/v/'.$ID.'" type="application/x-shockwave-flash" width="425" height="350"></embed>'.
'</object>');
by this: case 'youtube' : return ('<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'.$ID.'" name="wmode" value="transparent"></param>'.
'<embed src="http://www.youtube.com/v/'.$ID.'" type="application/x-shockwave-flash" width="425" height="350" wmode="transparent"></embed>'.
'</object>');
I didn't test for other videos, but I guess if you change this for Google & MySPace, it will work the same. Hope this helps.
Comments
Same problems occur here Any way to solve it?
1. Add:
$sReturn = $this->AutoLink($sReturn);
Above:
return $sReturn;
in function Execute()
2. Add (code taken from the Extended Text Formatter):
function AutoLink($String) { $String = str_replace(array(""","&"),array('"','&'),$String); $String = preg_replace( "/ (?<!<a href=\") (?<!\")(?<!\">) ((https?|ftp):\/\/) ([\@a-z0-9\x21\x23-\x27\x2a-\x2e\x3a\x3b\/;\x3f-\x7a\x7e\x3d]+) /msxi", "<a href=\"$0\" target=\"_blank\" rel=\"nofollow\">$0</a>", $String); return $String; }
Between the Execute function and the VideoLink function.
That's it!
its a blog thingy
or a way to have safe javascript like the one from google that allows embedding of google gadgets in ur webpage.
Replace this, at line 122:
case 'youtube' : return ('<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'.$ID.'"></param>'. '<embed src="http://www.youtube.com/v/'.$ID.'" type="application/x-shockwave-flash" width="425" height="350"></embed>'. '</object>');
by this:
case 'youtube' : return ('<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'.$ID.'" name="wmode" value="transparent"></param>'. '<embed src="http://www.youtube.com/v/'.$ID.'" type="application/x-shockwave-flash" width="425" height="350" wmode="transparent"></embed>'. '</object>');
I didn't test for other videos, but I guess if you change this for Google & MySPace, it will work the same. Hope this helps.
The text inside them simple disappear.
Thanks!