Partly reverted, real problem fixed
This commit is contained in:
parent
cb77b1af8c
commit
1b7f96dac8
|
@ -2696,7 +2696,7 @@ function api_get_entitities(&$text, $bbcode)
|
||||||
preg_match_all("/\[img\=(.*?)\](.*?)\[\/img\]/ism", $bbcode, $images, PREG_SET_ORDER);
|
preg_match_all("/\[img\=(.*?)\](.*?)\[\/img\]/ism", $bbcode, $images, PREG_SET_ORDER);
|
||||||
$ordered_images = [];
|
$ordered_images = [];
|
||||||
foreach ($images as $image) {
|
foreach ($images as $image) {
|
||||||
$start = iconv_strpos($text, Photo::getGUID($image[1]), 0, "UTF-8");
|
$start = iconv_strpos($text, $image[1], 0, "UTF-8");
|
||||||
if (!($start === false)) {
|
if (!($start === false)) {
|
||||||
$ordered_images[$start] = ['url' => $image[1], 'alt' => $image[2]];
|
$ordered_images[$start] = ['url' => $image[1], 'alt' => $image[2]];
|
||||||
}
|
}
|
||||||
|
@ -2704,7 +2704,7 @@ function api_get_entitities(&$text, $bbcode)
|
||||||
|
|
||||||
preg_match_all("/\[img](.*?)\[\/img\]/ism", $bbcode, $images);
|
preg_match_all("/\[img](.*?)\[\/img\]/ism", $bbcode, $images);
|
||||||
foreach ($images[1] as $image) {
|
foreach ($images[1] as $image) {
|
||||||
$start = iconv_strpos($text, Photo::getGUID($image), 0, "UTF-8");
|
$start = iconv_strpos($text, $image, 0, "UTF-8");
|
||||||
if (!($start === false)) {
|
if (!($start === false)) {
|
||||||
$ordered_images[$start] = ['url' => $image, 'alt' => ''];
|
$ordered_images[$start] = ['url' => $image, 'alt' => ''];
|
||||||
}
|
}
|
||||||
|
@ -2723,7 +2723,7 @@ function api_get_entitities(&$text, $bbcode)
|
||||||
$display_url = substr($display_url, 0, 25)."…";
|
$display_url = substr($display_url, 0, 25)."…";
|
||||||
}
|
}
|
||||||
|
|
||||||
$start = iconv_strpos($text, Photo::getGUID($url), $offset, "UTF-8");
|
$start = iconv_strpos($text, $url, $offset, "UTF-8");
|
||||||
if (!($start === false)) {
|
if (!($start === false)) {
|
||||||
$image = Image::getInfoFromURL($url);
|
$image = Image::getInfoFromURL($url);
|
||||||
if ($image) {
|
if ($image) {
|
||||||
|
|
|
@ -1567,7 +1567,7 @@ function photos_content(App $a)
|
||||||
|
|
||||||
$a->page['htmlhead'] .= "\n" . '<meta name="twitter:card" content="summary_large_image" />' . "\n";
|
$a->page['htmlhead'] .= "\n" . '<meta name="twitter:card" content="summary_large_image" />' . "\n";
|
||||||
$a->page['htmlhead'] .= '<meta name="twitter:title" content="' . $photo["album"] . '" />' . "\n";
|
$a->page['htmlhead'] .= '<meta name="twitter:title" content="' . $photo["album"] . '" />' . "\n";
|
||||||
$a->page['htmlhead'] .= '<meta name="twitter:image" content="' . $photo["href"] . '" />' . "\n";
|
$a->page['htmlhead'] .= '<meta name="twitter:image" content="' . System::baseUrl() . "/" . $photo["href"] . '" />' . "\n";
|
||||||
$a->page['htmlhead'] .= '<meta name="twitter:image:width" content="' . $photo["width"] . '" />' . "\n";
|
$a->page['htmlhead'] .= '<meta name="twitter:image:width" content="' . $photo["width"] . '" />' . "\n";
|
||||||
$a->page['htmlhead'] .= '<meta name="twitter:image:height" content="' . $photo["height"] . '" />' . "\n";
|
$a->page['htmlhead'] .= '<meta name="twitter:image:height" content="' . $photo["height"] . '" />' . "\n";
|
||||||
|
|
||||||
|
|
|
@ -1101,8 +1101,12 @@ class BBCode extends BaseObject
|
||||||
// if its a link to a picture then embed this picture
|
// if its a link to a picture then embed this picture
|
||||||
if (substr($curl_info["content_type"], 0, 6) == "image/") {
|
if (substr($curl_info["content_type"], 0, 6) == "image/") {
|
||||||
$text = "[img]" . $match[1] . "[/img]";
|
$text = "[img]" . $match[1] . "[/img]";
|
||||||
|
} else {
|
||||||
|
if (!empty($match[3])) {
|
||||||
|
$text = "[img=" . $match[2] . "]" . $match[3] . "[/img]";
|
||||||
} else {
|
} else {
|
||||||
$text = "[img]" . $match[2] . "[/img]";
|
$text = "[img]" . $match[2] . "[/img]";
|
||||||
|
}
|
||||||
|
|
||||||
// if its not a picture then look if its a page that contains a picture link
|
// if its not a picture then look if its a page that contains a picture link
|
||||||
$body = Network::fetchUrl($match[1]);
|
$body = Network::fetchUrl($match[1]);
|
||||||
|
@ -1120,10 +1124,14 @@ class BBCode extends BaseObject
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strtolower($attr["name"]) == "twitter:image") {
|
if (strtolower($attr["name"]) == "twitter:image") {
|
||||||
|
if (!empty($match[3])) {
|
||||||
|
$text = "[img=" . $attr["content"] . "]" . $match[3] . "[/img]";
|
||||||
|
} else {
|
||||||
$text = "[img]" . $attr["content"] . "[/img]";
|
$text = "[img]" . $attr["content"] . "[/img]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Cache::set($match[1], $text);
|
Cache::set($match[1], $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1132,7 +1140,8 @@ class BBCode extends BaseObject
|
||||||
|
|
||||||
public static function cleanPictureLinks($text)
|
public static function cleanPictureLinks($text)
|
||||||
{
|
{
|
||||||
$return = preg_replace_callback("&\[url=([^\[\]]*)\]\[img\](.*)\[\/img\]\[\/url\]&Usi", 'self::cleanPictureLinksCallback', $text);
|
$return = preg_replace_callback("&\[url=([^\[\]]*)\]\[img=(.*)\](.*)\[\/img\]\[\/url\]&Usi", 'self::cleanPictureLinksCallback', $text);
|
||||||
|
$return = preg_replace_callback("&\[url=([^\[\]]*)\]\[img\](.*)\[\/img\]\[\/url\]&Usi", 'self::cleanPictureLinksCallback', $return);
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue