* @brief Callback function to replace a Diaspora style mention in a mention for Friendica
*
* @param array $match Matching values for the callback
- * @return text Replaced mention
+ * @return string Replaced mention
*/
function diaspora_mention2bb($match) {
if ($match[2] == '') {
return;
}
- /// @todo Don't use probe
- //$data = Probe::uri($match[2]);
$data = get_contact_details_by_addr($match[2]);
$name = $match[1];
$s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
// Handles single newlines
- $s = str_replace("\r", '<br>', $s);
-
+ $s = str_replace("\r\n", "\n", $s);
$s = str_replace("\n", " \n", $s);
+ $s = str_replace("\r", " \n", $s);
// Replace lonely stars in lines not starting with it with literal stars
$s = preg_replace('/^([^\*]+)\*([^\*]*)$/im', '$1\*$2', $s);
$s = str_replace('#', '#', $s);
- $search = array(" \n", "\n ");
- $replace = array("\n", "\n");
- do {
- $oldtext = $s;
- $s = str_replace($search, $replace, $s);
- } while ($oldtext != $s);
-
- $s = str_replace("\n\n", '<br>', $s);
-
$s = html2bbcode($s);
// protect the recycle symbol from turning into a tag, but without unescaping angles and naked ampersands
* @brief Callback function to replace a Friendica style mention in a mention for Diaspora
*
* @param array $match Matching values for the callback
- * @return text Replaced mention
+ * @return string Replaced mention
*/
function diaspora_mentions($match) {