Przeglądaj źródła

Some more replacments in Subs-Post.

Signed-off-by: Jeremy D <[email protected]>
Jeremy D 10 lat temu
rodzic
commit
3834321989
3 zmienionych plików z 6 dodań i 5 usunięć
  1. 1 1
      Sources/Class-Package.php
  2. 4 3
      Sources/Modlog.php
  3. 1 1
      Sources/Subs-Editor.php

+ 1 - 1
Sources/Class-Package.php

@@ -612,7 +612,7 @@ class xmlArray
 		$trans_tbl = array_flip(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES));
 
 		// Translate all the entities out.
-		$data = strtr(preg_replace('~&#(\d{1,4});~e', "chr('\$1')", $data), $trans_tbl);
+		$data = strtr(preg_replace_callback('~&#(\d{1,4});~e', create_function('$m', 'return chr("\$m[1]");'), $data), $trans_tbl);
 
 		return $this->trim ? trim($data) : $data;
 	}

+ 4 - 3
Sources/Modlog.php

@@ -630,14 +630,15 @@ function list_getModLogEntries($start, $items_per_page, $sort, $query_string = '
 }
 
 /**
- * Smiely Replacment Callback.
+ * Mog Log Replacment Callback.
  *
- * Our callback that does the actual smiley replacments.
+ * Our callback that does the actual replacments.
  *
  * Original code from: http://php.net/manual/en/function.preg-replace-callback.php#88013
  * This is needed until SMF only supports PHP 5.3+ and we change to "use"
  *
- * @param string $replacements
+ * @param string $entries
+ * @param string $key
  * @param string $matches
  * @return string the replaced results.
  */

+ 1 - 1
Sources/Subs-Editor.php

@@ -76,7 +76,7 @@ function bbc_to_html($text, $compat_mode = false)
 
 	// Parse unique ID's and disable javascript into the smileys - using the double space.
 	$i = 1;
-	$text = preg_replace('~(?:\s|&nbsp;)?<(img\ssrc="' . preg_quote($modSettings['smileys_url'], '~') . '/[^<>]+?/([^<>]+?)"\s*)[^<>]*?class="smiley" />~e', '\'<\' . ' . 'stripslashes(\'$1\') . \'alt="" title="" onresizestart="return false;" id="smiley_\' . ' . "\$" . 'i++ . \'_$2" style="padding: 0 3px 0 3px;" />\'', $text);
+	$text = preg_replace_callback('~(?:\s|&nbsp;)?<(img\ssrc="' . preg_quote($modSettings['smileys_url'], '~') . '/[^<>]+?/([^<>]+?)"\s*)[^<>]*?class="smiley" />~', create_function('$m', 'return \'<\' . ' . 'stripslashes(\'$1\') . \'alt="" title="" onresizestart="return false;" id="smiley_\' . ' . "\$" . 'i++ . \'_$2" style="padding: 0 3px 0 3px;" />\';'), $text);
 
 	return $text;
 }