Url in text to active link converter
Posted by cabo
Url in text to active link converter May 09, 2001 05:24PM |
I have created a simple function, that replaces [xy]... links in the body text, to active links (to html a tags).
I have not tested the function much, but it worked for me so far.
You can test the function at [www.cabo.f2s.com]
The new version of the function (0.4) has now an option to target option to the html tag (e.g. for opening all links in a new window) and an option to limit the size off the url (only tested on my local server, see the text files for details)
(You can also find the textfile at [www.cabo.f2s.com] )
I have not tested the function much, but it worked for me so far.
You can test the function at [www.cabo.f2s.com]
The new version of the function (0.4) has now an option to target option to the html tag (e.g. for opening all links in a new window) and an option to limit the size off the url (only tested on my local server, see the text files for details)
(You can also find the textfile at [www.cabo.f2s.com] )
eregi correction for url2link May 10, 2001 08:59AM |
In the function intexturl2html
change eregi command the line
if (eregi("([a-z0-9/.:]+)", $text, $urlereg)==true) {
to
if (eregi("([a-z0-9:%\?\/\.\,\+\-]+)", $text, $urlereg)==true) {
Explanation; the extract expression was flase. I never used such expression, so i'm new to this. It still can be improved and some chars, which are allowed in an url can/must be added
change eregi command the line
if (eregi("([a-z0-9/.:]+)", $text, $urlereg)==true) {
to
if (eregi("([a-z0-9:%\?\/\.\,\+\-]+)", $text, $urlereg)==true) {
Explanation; the extract expression was flase. I never used such expression, so i'm new to this. It still can be improved and some chars, which are allowed in an url can/must be added
and another one... May 10, 2001 07:27PM |
if (eregi("([a-z0-9:%=&\?\/\.\,\+\-]+)", $text, $urlereg)==true) {
now phorum links work again (worked with the old, but not with the new function)
some functions for forum codes, might be more to come (...)
[www.phorum.org] and
Phorum
(don't mix this with the current url2link function)
$body = eregi_replace("\+)\x5d([^\[]+)\[/url\x5d","<a href=\"[&]);
$body = eregi_replace("\[url\x5d(http://|())([^\[]+)\[/url\x5d","<a href=\"[&] );
now phorum links work again (worked with the old, but not with the new function)
some functions for forum codes, might be more to come (...)
[www.phorum.org] and
Phorum
(don't mix this with the current url2link function)
$body = eregi_replace("\+)\x5d([^\[]+)\[/url\x5d","<a href=\"[&]);
$body = eregi_replace("\[url\x5d(http://|())([^\[]+)\[/url\x5d","<a href=\"[&] );
codes as plugin June 01, 2001 09:49AM |
codes and autolink as plugin
To use the use the plugin with phorum, create a dir named
"phcode" in your phorum/plugin directory. (if you change the
name, don't forget to edit the source)
add the line include("./plugin/phcode/plugin.php");
in phorum/plugin/plugin.php <br>
(e.g. after include("./plugin/replace/plugin.php"); )
then extract the files settings.php,plugin.php,admin.php
from the the textfile (see the attachment) into phorum/plugin/phcode.
You can now enable/disable the option for the plugin in the
admin section, but you can't disable the plugin for now.
***DON't mix this with the url2link function posted above***
I haven't had much time to test this, so be careful with it.
(i have only tested it on my local server)
To use the use the plugin with phorum, create a dir named
"phcode" in your phorum/plugin directory. (if you change the
name, don't forget to edit the source)
add the line include("./plugin/phcode/plugin.php");
in phorum/plugin/plugin.php <br>
(e.g. after include("./plugin/replace/plugin.php"); )
then extract the files settings.php,plugin.php,admin.php
from the the textfile (see the attachment) into phorum/plugin/phcode.
You can now enable/disable the option for the plugin in the
admin section, but you can't disable the plugin for now.
***DON't mix this with the url2link function posted above***
I haven't had much time to test this, so be careful with it.
(i have only tested it on my local server)
Re: codes as plugin June 01, 2001 10:59AM |
I love it, when i post code and find some bugs a few minutes later ;)
This is a new admin.php, so you can en/disable the autolink and/or forum codes
correct.
I try to update my f2s forum today for a demo
[www.cabo.f2s.com]
(i will post it in the test phorum)
This is a new admin.php, so you can en/disable the autolink and/or forum codes
correct.
I try to update my f2s forum today for a demo
[www.cabo.f2s.com]
(i will post it in the test phorum)
Re: codes as plugin June 01, 2001 03:27PM |
Re: codes as plugin June 01, 2001 03:50PM |
Re: codes as plugin June 01, 2001 06:33PM |
Updated and bugfixed plugin.php.
For a useful [ code ] forum tag, i need to program a new function, so that it works correct in all cases, but you can try the current [ code ] for non url and non phorum code text
Test Forum for the plugin and with some examples at:
[www.cabo.f2s.com]
For a useful [ code ] forum tag, i need to program a new function, so that it works correct in all cases, but you can try the current [ code ] for non url and non phorum code text
Test Forum for the plugin and with some examples at:
[www.cabo.f2s.com]
Michael
Re: codes as plugin June 03, 2001 04:56PM |
Re: codes as plugin June 03, 2001 06:44PM |
Re: codes as plugin June 04, 2001 05:35AM |
m:The only thing is that is doesn't show up in the preview.
v:cabo, can you fix that?
yes (or i hope so ;) - i already have download the preview plugin and i will test it today (i think that this would be a good feature, because then you know if the formating codes work right for your text).
v:cabo, can you fix that?
yes (or i hope so ;) - i already have download the preview plugin and i will test it today (i think that this would be a good feature, because then you know if the formating codes work right for your text).
Michael
preview *plugin*? - ezBoards June 04, 2001 08:04AM |
cabo wrote:
> yes (or i hope so ;) - i already have download the preview
> plugin and i will test it today (i think that this would be a
> good feature, because then you know if the formating codes
> work right for your text).
Preview plugin? I've downloaded my phorum "3.2.11-PHF" at the German myPhorum.de site
[www.myphorum.de]
and the preview is "built in" - there is no dedicated plugin in the folder.
My phorum: [www.netzwerk.f2s.com] (German)
Just testing hackers.phorum.org ;-)
Forum zur Sicherheit im Kabelnetzwerk
BTW: I've changed my forum from ezBoards ("all inclusive" board provider inclusive commercials) to phorum because at ezBoards they started to delight the communities with popup windows. As far as I know there is no converter but I am sure that there are lots of webmasters with huge boards who want to get off ezBoards (see their support forums).
For those who are interested here my closed ezBoard:
[pub15.ezboard.com]
Phorum rocks! Thank you all! Now I have full control over the board. The only thing I am depending on is the database and webspace provider. But after one week full of downtimes f2s.com seems to be stable now (of course I shouldn't put the kiss of death on them ;-)
> yes (or i hope so ;) - i already have download the preview
> plugin and i will test it today (i think that this would be a
> good feature, because then you know if the formating codes
> work right for your text).
Preview plugin? I've downloaded my phorum "3.2.11-PHF" at the German myPhorum.de site
[www.myphorum.de]
and the preview is "built in" - there is no dedicated plugin in the folder.
My phorum: [www.netzwerk.f2s.com] (German)
Just testing hackers.phorum.org ;-)
Forum zur Sicherheit im Kabelnetzwerk
BTW: I've changed my forum from ezBoards ("all inclusive" board provider inclusive commercials) to phorum because at ezBoards they started to delight the communities with popup windows. As far as I know there is no converter but I am sure that there are lots of webmasters with huge boards who want to get off ezBoards (see their support forums).
For those who are interested here my closed ezBoard:
[pub15.ezboard.com]
Phorum rocks! Thank you all! Now I have full control over the board. The only thing I am depending on is the database and webspace provider. But after one week full of downtimes f2s.com seems to be stable now (of course I shouldn't put the kiss of death on them ;-)
it works with preview plugin June 04, 2001 09:47AM |
I just tested the phcode plugin with the preview plug and it works, when you add the phcode plugin first in the plugin.php in the main plugin folder.
(Phorum 3.3dev)
e.g.:
// autourl and phcode
include("./plugin/phcode/plugin.php");
//Preview
include("./plugin/Preview/plugin.php");
The version from myphorum.de is a hacked version. They created a release with some included hacks. I will dld the version to test it.
PS: I also changed from ezboard ;) F2s: check the network news form their site for network status/news.
(Phorum 3.3dev)
e.g.:
// autourl and phcode
include("./plugin/phcode/plugin.php");
//Preview
include("./plugin/Preview/plugin.php");
The version from myphorum.de is a hacked version. They created a release with some included hacks. I will dld the version to test it.
PS: I also changed from ezboard ;) F2s: check the network news form their site for network status/news.
Michael
You are the man, cabo! June 04, 2001 10:22AM |
cabo wrote:
> The version from myphorum.de is a hacked version. They
> created a release with some included hacks. I will dld the
> version to test it.
Thx in advance! Would be great to have the codes/preview function in that version.
> PS: I also changed from ezboard ;) F2s: check the network
> news form their site for network status/news.
The last entry there is from May 14...
> The version from myphorum.de is a hacked version. They
> created a release with some included hacks. I will dld the
> version to test it.
Thx in advance! Would be great to have the codes/preview function in that version.
> PS: I also changed from ezboard ;) F2s: check the network
> news form their site for network status/news.
The last entry there is from May 14...
Re: You are the man, cabo! June 04, 2001 05:58PM |
Updated [ code ] function and more June 04, 2001 08:07PM |
An update to the [ code ] function:
$body = preg_replace("/\[code\](.*?)\[\/code\]/si","<blockquote>code<hr><pre><code>\\1</code></pre><hr></blockquote>",$body);
I just noticed that php 3.3 has already a format [ code ], so you need to rename it or disable the phorum replacement.
There is a problem with linebreaks when phorum uses the my_nl2br from common.php.
1) add a space (empty) char in each replacement function (right before ;",$body); )
2) change the return line in the my_nl2br function to just return $str;
(but could cause problems, because somone had a reason to remove the ><br> linebreaks ;)
$body = preg_replace("/\[code\](.*?)\[\/code\]/si","<blockquote>code<hr><pre><code>\\1</code></pre><hr></blockquote>",$body);
I just noticed that php 3.3 has already a format [ code ], so you need to rename it or disable the phorum replacement.
There is a problem with linebreaks when phorum uses the my_nl2br from common.php.
1) add a space (empty) char in each replacement function (right before ;",$body); )
2) change the return line in the my_nl2br function to just return $str;
(but could cause problems, because somone had a reason to remove the ><br> linebreaks ;)
Re: Updated [ code ] function and more June 04, 2001 08:42PM |
Re: Updated [ code ] function and more June 04, 2001 08:46PM |
Re: Updated [ code ] function and more July 31, 2001 05:36PM |
Sorry, you do not have permission to post/reply in this forum.