[geeklog-hg] geeklog: Fixed a bug where a period of a sentence was regarded a...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Tue Jan 14 07:56:57 EST 2014


changeset 9427:64e171399ce1
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/64e171399ce1
user: Kenji ITO <mystralkk at gmail.com>
date: Tue Jan 14 21:56:29 2014 +0900
description:
Fixed a bug where a period of a sentence was regarded as part of link text (bug #0001675)

diffstat:

 public_html/lib-common.php |  21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diffs (33 lines):

diff -r fcb504ac8d4d -r 64e171399ce1 public_html/lib-common.php
--- a/public_html/lib-common.php	Tue Jan 14 11:03:23 2014 +0900
+++ b/public_html/lib-common.php	Tue Jan 14 21:56:29 2014 +0900
@@ -6987,14 +6987,23 @@
 function COM_makeClickableLinksCallback( $http, $link )
 {
     global $_CONF;
-    
+
+    // When $link ends with a period, the period will be moved out of the link
+    // text (bug #0001675)
+    if (substr($link, -1) === '.') {
+        $link = substr($link, 0, -1);
+        $end = '.';
+    } else {
+        $end = '';
+    }
+
     if ($_CONF['linktext_maxlen'] > 0) {
-        $text = COM_truncate( $link, $_CONF['linktext_maxlen'], '...', '10' );
+        $text = COM_truncate($link, $_CONF['linktext_maxlen'], '...', 10);
     } else {
-        $text = $link;        
-    }
-
-    return "<a href=\"$http$link\">$text</a>";
+        $text = $link;
+    }
+
+    return "<a href=\"{$http}{$link}\">{$text}</a>{$end}";
 }
 
 /**



More information about the geeklog-cvs mailing list