Merge https://github.com/friendica/friendica into pull
This commit is contained in:
commit
af789ee98b
|
@ -162,6 +162,22 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) {
|
|||
$md = new Markdownify(false, false, false);
|
||||
$Text = $md->parseString($Text);
|
||||
|
||||
// The Markdownify converter converts underscores '_' in URLs to '\_', which
|
||||
// messes up the URL. Manually fix these
|
||||
$count = 1;
|
||||
$pos = bb_find_open_close($Text, '[', ']', $count);
|
||||
while($pos !== false) {
|
||||
$start = substr($Text, 0, $pos['start']);
|
||||
$subject = substr($Text, $pos['start'], $pos['end'] - $pos['start'] + 1);
|
||||
$end = substr($Text, $pos['end'] + 1);
|
||||
|
||||
$subject = str_replace('\_', '_', $subject);
|
||||
$Text = $start . $subject . $end;
|
||||
|
||||
$count++;
|
||||
$pos = bb_find_open_close($Text, '[', ']', $count);
|
||||
}
|
||||
|
||||
// If the text going into bbcode() has a plain URL in it, i.e.
|
||||
// with no [url] tags around it, it will come out of parseString()
|
||||
// looking like: <http://url.com>, which gets removed by strip_tags().
|
||||
|
|
|
@ -47,6 +47,30 @@ function bb_unspacefy_and_trim($st) {
|
|||
return $unspacefied;
|
||||
}
|
||||
|
||||
function bb_find_open_close($s, $open, $close, $occurance = 1) {
|
||||
|
||||
if($occurance < 1)
|
||||
$occurance = 1;
|
||||
|
||||
$start_pos = -1;
|
||||
for($i = 1; $i <= $occurance; $i++) {
|
||||
if( $start_pos !== false)
|
||||
$start_pos = strpos($s, $open, $start_pos + 1);
|
||||
}
|
||||
|
||||
if( $start_pos === false)
|
||||
return false;
|
||||
|
||||
$end_pos = strpos($s, $close, $start_pos);
|
||||
|
||||
if( $end_pos === false)
|
||||
return false;
|
||||
|
||||
$res = array( 'start' => $start_pos, 'end' => $end_pos );
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
function get_bb_tag_pos($s, $name, $occurance = 1) {
|
||||
|
||||
if($occurance < 1)
|
||||
|
|
|
@ -1350,6 +1350,9 @@ input#dfrn-url {
|
|||
.divgrow-showmore {
|
||||
display: block;
|
||||
clear: both;
|
||||
text-align: center;
|
||||
outline: 0;
|
||||
border-top: 1px dotted #888;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1413,6 +1416,7 @@ input#dfrn-url {
|
|||
border-bottom-right-radius: 10px;
|
||||
}
|
||||
|
||||
|
||||
.comment-edit-wrapper {
|
||||
margin-top: 15px;
|
||||
background: #f3f3f3;
|
||||
|
|
|
@ -1307,6 +1307,9 @@ input#dfrn-url {
|
|||
.divgrow-showmore {
|
||||
display: block;
|
||||
clear: both;
|
||||
text-align: center;
|
||||
outline: 0;
|
||||
border-top: 1px dotted #888;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue