#21869 [Com]: Link and Mailto parsing functions

2003-01-24 Thread spoon
 ID:   21869
 Comment by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
 Status:   Duplicate
 Bug Type: Feature/Change Request
 Operating System: XP Pro
 PHP Version:  5CVS-2003-01-24 (dev)
 New Comment:

/include/functions.inc  (i was forgetting /include)

function addlinks($text) 
{
$text = htmlspecialchars($text);
$text =
preg_replace("/((mailto|http|ftp|nntp|news):.+?)(>|\\s|\\)|\\.\\s|$)/i","\\1\\3",$text);
# what the heck is this for?
$text = preg_replace("/[.,]?-=-\"/", '"', $text);
return $text;
}


W. PHP.NET RULES!


Previous Comments:


[2003-01-24 16:45:00] [EMAIL PROTECTED]

In the source of your bug.php, at the very bottom it has a line:

$note =
addlinks(preg_replace("/(\r?\n){3,}/","\n\n",wordwrap($comment,72,"\n",1)));


addlinks is not defined in the source, so i am assuming it is in
prepend.inc (?), but unfortunatley, we cannot view .inc files using
source.php, any help?



[2003-01-24 16:32:41] [EMAIL PROTECTED]

Pear does not have this ability, as far as i can see from pear.php.net



[2003-01-24 16:21:03] [EMAIL PROTECTED]

Dup of #6893.



[2003-01-24 16:13:37] [EMAIL PROTECTED]

THIS PAGE DOES IT! (NOT THE EMAIL THOUGH) (but it is a non full proof
regex?)

Still, if it is a GOOD regex, that almost never messes up, a function
would be ... easier :D



[2003-01-24 16:11:32] [EMAIL PROTECTED]

First, this task can be accomplished with a regex, but it is only _so_
effective.

If there was some way to make functions that would take in a string,
and return a string that has all links, and all email addresses (2
seperate functions, or one with a set of switches) properly formatted
to work as links.

The reason it is hard with regex, is becuase it is impossible to search
for a link when it can be formatted so many ways.



/** simple **/
$string = "Hey, check out http://www.spoonified.com, and email me at
[EMAIL PROTECTED]";

$linkified = hrefparse($string);

echo $linkified;
/***/

returns this:

Hey, check out http://www.spoonified.com";>http://www.spoonified.com, and
email me at mailto:[EMAIL PROTECTED]";>[EMAIL PROTECTED]



of course, the link, the main reason regex is bad, could have many
things in it, it could point to a file, have a query string in it, have
no www, have many PERIODS (multiple subdomains), be https://, and also
not be seperated from other text (such as
"OMFGwww.spoonified.comRULES"), and the list goes on.

Email addresses follow the same conditions i mentioned above (minus a
few of course, and plus a few also).

Maybe im just overlooking a complex enough regex to do this.

I DO know it can be done. Many IRC/Instant Message programs do a
wonderful job of it. They take a link, no matter what conditions, or an
email address, and will show an active link once sent. Obviously there
is a rexeg im too lame to understand, or a better way to accomplish
it.



(also, you 5.0.xCVS is still having an error on the php4apache2.dll
compile, just a sidenote, no comments needed, i think you guys are
already aware)






-- 
Edit this bug report at http://bugs.php.net/?id=21869&edit=1




#21869 [Com]: Link and Mailto parsing functions

2003-01-24 Thread spoon
 ID:   21869
 Comment by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
 Status:   Duplicate
 Bug Type: Feature/Change Request
 Operating System: XP Pro
 PHP Version:  5CVS-2003-01-24 (dev)
 New Comment:

In the source of your bug.php, at the very bottom it has a line:

$note =
addlinks(preg_replace("/(\r?\n){3,}/","\n\n",wordwrap($comment,72,"\n",1)));


addlinks is not defined in the source, so i am assuming it is in
prepend.inc (?), but unfortunatley, we cannot view .inc files using
source.php, any help?


Previous Comments:


[2003-01-24 16:32:41] [EMAIL PROTECTED]

Pear does not have this ability, as far as i can see from pear.php.net



[2003-01-24 16:21:03] [EMAIL PROTECTED]

Dup of #6893.



[2003-01-24 16:13:37] [EMAIL PROTECTED]

THIS PAGE DOES IT! (NOT THE EMAIL THOUGH) (but it is a non full proof
regex?)

Still, if it is a GOOD regex, that almost never messes up, a function
would be ... easier :D



[2003-01-24 16:11:32] [EMAIL PROTECTED]

First, this task can be accomplished with a regex, but it is only _so_
effective.

If there was some way to make functions that would take in a string,
and return a string that has all links, and all email addresses (2
seperate functions, or one with a set of switches) properly formatted
to work as links.

The reason it is hard with regex, is becuase it is impossible to search
for a link when it can be formatted so many ways.



/** simple **/
$string = "Hey, check out http://www.spoonified.com, and email me at
[EMAIL PROTECTED]";

$linkified = hrefparse($string);

echo $linkified;
/***/

returns this:

Hey, check out http://www.spoonified.com";>http://www.spoonified.com, and
email me at mailto:[EMAIL PROTECTED]";>[EMAIL PROTECTED]



of course, the link, the main reason regex is bad, could have many
things in it, it could point to a file, have a query string in it, have
no www, have many PERIODS (multiple subdomains), be https://, and also
not be seperated from other text (such as
"OMFGwww.spoonified.comRULES"), and the list goes on.

Email addresses follow the same conditions i mentioned above (minus a
few of course, and plus a few also).

Maybe im just overlooking a complex enough regex to do this.

I DO know it can be done. Many IRC/Instant Message programs do a
wonderful job of it. They take a link, no matter what conditions, or an
email address, and will show an active link once sent. Obviously there
is a rexeg im too lame to understand, or a better way to accomplish
it.



(also, you 5.0.xCVS is still having an error on the php4apache2.dll
compile, just a sidenote, no comments needed, i think you guys are
already aware)






-- 
Edit this bug report at http://bugs.php.net/?id=21869&edit=1




#21869 [Com]: Link and Mailto parsing functions

2003-01-24 Thread spoon
 ID:   21869
 Comment by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
 Status:   Duplicate
 Bug Type: Feature/Change Request
 Operating System: XP Pro
 PHP Version:  5CVS-2003-01-24 (dev)
 New Comment:

Pear does not have this ability, as far as i can see from pear.php.net


Previous Comments:


[2003-01-24 16:21:03] [EMAIL PROTECTED]

Dup of #6893.



[2003-01-24 16:13:37] [EMAIL PROTECTED]

THIS PAGE DOES IT! (NOT THE EMAIL THOUGH) (but it is a non full proof
regex?)

Still, if it is a GOOD regex, that almost never messes up, a function
would be ... easier :D



[2003-01-24 16:11:32] [EMAIL PROTECTED]

First, this task can be accomplished with a regex, but it is only _so_
effective.

If there was some way to make functions that would take in a string,
and return a string that has all links, and all email addresses (2
seperate functions, or one with a set of switches) properly formatted
to work as links.

The reason it is hard with regex, is becuase it is impossible to search
for a link when it can be formatted so many ways.



/** simple **/
$string = "Hey, check out http://www.spoonified.com, and email me at
[EMAIL PROTECTED]";

$linkified = hrefparse($string);

echo $linkified;
/***/

returns this:

Hey, check out http://www.spoonified.com";>http://www.spoonified.com, and
email me at mailto:[EMAIL PROTECTED]";>[EMAIL PROTECTED]



of course, the link, the main reason regex is bad, could have many
things in it, it could point to a file, have a query string in it, have
no www, have many PERIODS (multiple subdomains), be https://, and also
not be seperated from other text (such as
"OMFGwww.spoonified.comRULES"), and the list goes on.

Email addresses follow the same conditions i mentioned above (minus a
few of course, and plus a few also).

Maybe im just overlooking a complex enough regex to do this.

I DO know it can be done. Many IRC/Instant Message programs do a
wonderful job of it. They take a link, no matter what conditions, or an
email address, and will show an active link once sent. Obviously there
is a rexeg im too lame to understand, or a better way to accomplish
it.



(also, you 5.0.xCVS is still having an error on the php4apache2.dll
compile, just a sidenote, no comments needed, i think you guys are
already aware)






-- 
Edit this bug report at http://bugs.php.net/?id=21869&edit=1




#21869 [Com]: Link and Mailto parsing functions

2003-01-24 Thread spoon
 ID:   21869
 Comment by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: XP Pro
 PHP Version:  5CVS-2003-01-24 (dev)
 New Comment:

THIS PAGE DOES IT! (NOT THE EMAIL THOUGH) (but it is a non full proof
regex?)

Still, if it is a GOOD regex, that almost never messes up, a function
would be ... easier :D


Previous Comments:


[2003-01-24 16:11:32] [EMAIL PROTECTED]

First, this task can be accomplished with a regex, but it is only _so_
effective.

If there was some way to make functions that would take in a string,
and return a string that has all links, and all email addresses (2
seperate functions, or one with a set of switches) properly formatted
to work as links.

The reason it is hard with regex, is becuase it is impossible to search
for a link when it can be formatted so many ways.



/** simple **/
$string = "Hey, check out http://www.spoonified.com, and email me at
[EMAIL PROTECTED]";

$linkified = hrefparse($string);

echo $linkified;
/***/

returns this:

Hey, check out http://www.spoonified.com";>http://www.spoonified.com, and
email me at mailto:[EMAIL PROTECTED]";>[EMAIL PROTECTED]



of course, the link, the main reason regex is bad, could have many
things in it, it could point to a file, have a query string in it, have
no www, have many PERIODS (multiple subdomains), be https://, and also
not be seperated from other text (such as
"OMFGwww.spoonified.comRULES"), and the list goes on.

Email addresses follow the same conditions i mentioned above (minus a
few of course, and plus a few also).

Maybe im just overlooking a complex enough regex to do this.

I DO know it can be done. Many IRC/Instant Message programs do a
wonderful job of it. They take a link, no matter what conditions, or an
email address, and will show an active link once sent. Obviously there
is a rexeg im too lame to understand, or a better way to accomplish
it.



(also, you 5.0.xCVS is still having an error on the php4apache2.dll
compile, just a sidenote, no comments needed, i think you guys are
already aware)






-- 
Edit this bug report at http://bugs.php.net/?id=21869&edit=1