OSDN Git Service

MERGE: shorten()の処理の変更に伴う本家の修正をマージ。
authorsakamocchi <o-takashi@sakamocchi.jp>
Tue, 17 Jan 2012 12:36:36 +0000 (21:36 +0900)
committersakamocchi <o-takashi@sakamocchi.jp>
Tue, 17 Jan 2012 12:36:36 +0000 (21:36 +0900)
MERGE: Merge revision 1627 on original code related to shorten() in
globalfunctions.php

nucleuscms.svn.sourceforge.net/viewvc/nucleuscms?view=revision&revision=1627

shorten()の元々の実装では、最終的に全てのHTMLエンティティを参照に変換してしまう。これは、関数の目的を超えた「おせっかいな」処理だったため、処理プロセスを大きく変更。それに伴いコアの数カ所を修正した。
At old implementation, shorten() return the string in which wholeHTML
entities are converted to references. But this is obtrusive. This
commit force it to convert the entities just included in target
string
and related modification in the other scripts.

nucleus/libs/COMMENT.php
nucleus/libs/globalfunctions.php
nucleus/libs/showlist.php

index e6ffd40..eb33f41 100644 (file)
@@ -162,7 +162,7 @@ class COMMENT {
                        $displayedUrl = $url;
                }
 
-               return $pre . '<a href="' . $linkedUrl . '" rel="nofollow">' . shorten($displayedUrl,30,'...') . '</a>' . $post;
+               return $pre . '<a href="' . $linkedUrl . '" rel="nofollow">' . i18n::hsc(shorten($displayedUrl,30,'...')) . '</a>' . $post;
        }
 
 
index 6c2f2de..94078f2 100644 (file)
@@ -10,7 +10,7 @@
  * of the License, or (at your option) any later version.
  * (see nucleus/documentation/index.html#license for more info)
  */
-/**ss
+/**
  * @license http://nucleuscms.org/license.txt GNU General Public License
  * @copyright Copyright (C) 2002-2009 The Nucleus Group
  * @version $Id: globalfunctions.php 1624 2012-01-09 11:36:20Z sakamocchi $
@@ -1536,13 +1536,13 @@ function removeBreaks($var) {
 }
 
 /**
- * shortens a text string to maxlength
+ * shortens a text string to maxlength.
  * $suffix is what needs to be added at the end (end length is <= $maxlength)
  *
  * The purpose is to limit the width of string for rendered screen in web browser.
  * So it depends on style sheet, browser's rendering scheme, client's system font.
  *
- * NOTE: In general, non-Latin font such as Japanese, Chinese, Cyrillic have two times as long as Latin fonts,
+ * NOTE: In general, non-Latin font such as Japanese, Chinese, Cyrillic have two times as width as Latin fonts,
  *  but this is not always correct, for example, rendered by proportional font.
  *
  * @param string $escaped_string target string
index 4366c5e..a6c4922 100644 (file)
@@ -77,7 +77,7 @@ function listplug_select($template, $type) {
                                echo ' selected="selected" ';
                        if (isset($template['shorten']) && $template['shorten'] > 0) {
                                echo ' title="'. i18n::hsc($current->text).'"';
-                               $current->text = shorten($current->text, $template['shorten'], $template['shortenel']);
+                               $current->text = i18n::hsc(shorten($current->text, $template['shorten'], $template['shortenel']));
                        }
                        echo '>' . i18n::hsc($current->text) . '</option>';
                        break;