This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Convert links at output
#1

Please convert_links ,At the output

comment_parser_convert_links
comment_parser_convert_emails

Now ,links converted to save data.
Ex. http://www.yahoo.com save to database,
Quote: <a href=http://www.yahoo.com" target=** rel="nofollow">http://www.yahoo.com</a>

Please Save data is plain URL/RawURL
And At the output ,convert_links.


---------------------------------------------------
Commentics's Japanese Commentary Site
http://commentics.bbfriend.net/
*Sorry...I am not good at English.
---------------------------------------------------
Reply
#2

So you want the links to be parsed on the output instead of being stored as html, right? There are a number of problems with that, so I doubt that the change will take place. Not only will the code need to be changed, something to convert the old comments in the database to fit this would be needed. Also, the other tags are also stored as html, so something would have to be done about them too. Also, this would add a little extra overhead to the server having to parse each comment every time it's loaded (even though the overhead is small, unless pagination is disabled or there is a lot of traffic on the server).
What would be better is updating the comment editor, because the current one is quite simplistic, and possibly even complicated for some people. A simple comment consisting of two links separated by a line break, a line of text, and some code in the [php] tag turns into a confusing mess of tags that someone inexperienced in html wouldn't be able to make anything out of.

I'm giving you three guesses...
Reply
#3

Quote:###################
#
#
####---- OPEN -----------------------
#
comments/includes/app/processor.php
#
###------ FIND -----------------------
# About Line 274

}
$comment = purify($comment); //purify html
$comment = comment_parse_links($comment); //convert links to html
if ($comment_line_breaks) {
$comment = comment_add_breaks($comment); //add line breaks (<br /> and <p />)
} else {

#
##---- Change to (or Replase With)---------------
# Add Commnet out

}
$comment = purify($comment); //purify html
// $comment = comment_parse_links($comment); //convert links to html
if ($comment_line_breaks) {
$comment = comment_add_breaks($comment); //add line breaks (<br /> and <p />)
} else {

#
####--------- OPEN -------------------------------
#

comments/includes/functions/comments.php

#
###------ FIND -----------------------------------
# About Line 114

//Comment
$box .= "<span class='comment_text'>";
$box .= $comment;
$box .= "</span>";
//Comment

#
##---- Change to (or Replase With)---------------
#

$box .= "<span class='comment_text'>";
//$box .= $comment;
$box .= comment_parse_links($comment); //convert links to html
$box .= "</span>";


My regular expression is
Code:
## If you Need
#
####--- OPEN ------------------------------------
#
comments/includes/functions/processor.php

#
###------ FIND ----------------------------------
#

if ($comment_parser_convert_links) { //if web links should be converted
  $comment= preg_replace("/(^|[n ])([w]*?)((ht|f)tp(s)?://[w]+[^ ,"nrt<]*)/is", "$1$2<a href="$3"$attribute>$3</a>", $comment);
  $comment= preg_replace("/(^|[n ])([w]*?)((www|ftp).[^ ,"tnr<]*)/is", "$1$2<a href="http://$3"$attribute>$3</a>", $comment);
}

#
##------ Replase With ----------------------------
#

if ($comment_parser_convert_links) { //if web links should be converted
//  $comment= preg_replace("/(^|[n ])([w]*?)((ht|f)tp(s)?://[w]+[^ ,"nrt<]*)/is", "$1$2<a href="$3"$attribute>$3</a>", $comment);
//  $comment= preg_replace("/(^|[n ])([w]*?)((www|ftp).[^ ,"tnr<]*)/is", "$1$2<a href="http://$3"$attribute>$3</a>", $comment);

$patterns = array("/(?<=(?<!'|"))(https?|ftp)(://[[:alnum:]+$;?.%,!#~*/:@&=_-]+)/i");
  $replacements = array("<a href="$1$2"$attribute>$1$2</a>");
  $comment = preg_replace($patterns, $replacements, $comment);}

---------------------------------------------------
Commentics's Japanese Commentary Site
http://commentics.bbfriend.net/
*Sorry...I am not good at English.
---------------------------------------------------
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post

Forum Jump:


Users browsing this thread: 1 Guest(s)