]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'testing' of gitorious.org:statusnet/mainline into testing
authorZach Copley <zach@status.net>
Mon, 1 Mar 2010 22:59:54 +0000 (14:59 -0800)
committerZach Copley <zach@status.net>
Mon, 1 Mar 2010 22:59:54 +0000 (14:59 -0800)
* 'testing' of gitorious.org:statusnet/mainline:
  Localization tweak: include doc comments marked as 'TRANS' in .po file output; these should now get automatically pulled through to the TranslateWiki interface as translator help hints.
  Add index on group_index.notice_id, needed to pull list of target groups for inbox delivery.
  Add index on post_id for file_to_post, needed for efficient lookups of files/urls attached to a given post.
  Update pot file

lib/util.php

index d12a7920d2d458e421ba841d2e453d72378f7b99..7a170a5f5fd58684c94bce53d3802e6016a7778c 100644 (file)
@@ -809,8 +809,28 @@ function common_shorten_links($text)
 
 function common_xml_safe_str($str)
 {
-    // Neutralize control codes and surrogates
-       return preg_replace('/[\p{Cc}\p{Cs}]/u', '*', $str);
+    // Replace common eol and extra whitespace input chars
+    $unWelcome = array(
+        "\t",  // tab
+        "\n",  // newline
+        "\r",  // cr
+        "\0",  // null byte eos
+        "\x0B" // vertical tab
+    );
+
+    $replacement = array(
+        ' ', // single space
+        ' ',
+        '',  // nothing
+        '',
+        ' '
+    );
+
+    $str = str_replace($unWelcome, $replacement, $str);
+
+    // Neutralize any additional control codes and UTF-16 surrogates
+    // (Twitter uses '*')
+    return preg_replace('/[\p{Cc}\p{Cs}]/u', '*', $str);
 }
 
 function common_tag_link($tag)