Merge pull request #3724 from annando/plaintext
Better content detection for posts to Twitter
This commit is contained in:
commit
d6d1ee9112
1 changed files with 12 additions and 6 deletions
|
@ -245,13 +245,19 @@ function get_attached_data($body) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match_all("(\[url\]([$URLSearchString]*)\[\/url\])ism", $body, $links, PREG_SET_ORDER)) {
|
preg_match_all("(\[url\]([$URLSearchString]*)\[\/url\])ism", $body, $links1, PREG_SET_ORDER);
|
||||||
|
preg_match_all("(\[url\=([$URLSearchString]*)\].*?\[\/url\])ism", $body, $links2, PREG_SET_ORDER);
|
||||||
|
|
||||||
|
$links = array_merge($links1, $links2);
|
||||||
|
|
||||||
if (count($links) == 1) {
|
if (count($links) == 1) {
|
||||||
$post["type"] = "text";
|
|
||||||
$post["url"] = $links[0][1];
|
$post["url"] = $links[0][1];
|
||||||
$post["text"] = $body;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count($links) > 0) {
|
||||||
|
unset($post["type"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($post["type"])) {
|
if (!isset($post["type"])) {
|
||||||
$post["type"] = "text";
|
$post["type"] = "text";
|
||||||
$post["text"] = trim($body);
|
$post["text"] = trim($body);
|
||||||
|
|
Loading…
Reference in a new issue