X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=mod%2Fparse_url.php;h=1393a15d36b95bd94a9ab69ebd6fa6a38cddacb7;hb=c35feb27f2d5d9a1dc9cf885517953663dae9748;hp=083a39b55f9012d2733ad55118d41c664d1b38b6;hpb=d3699498ac8fdbbce2883ac07c8a3aac9b11a8e4;p=friendica.git
diff --git a/mod/parse_url.php b/mod/parse_url.php
index 083a39b55f..1393a15d36 100644
--- a/mod/parse_url.php
+++ b/mod/parse_url.php
@@ -97,6 +97,28 @@ function parseurl_getsiteinfo($url) {
$xpath = new DomXPath($doc);
+ $list = $xpath->query("//meta[@content]");
+ foreach ($list as $node) {
+ $attr = array();
+ if ($node->attributes->length)
+ foreach ($node->attributes as $attribute)
+ $attr[$attribute->name] = $attribute->value;
+
+ if (@$attr["http-equiv"] == 'refresh') {
+ $path = $attr["content"];
+ $pathinfo = explode(";", $path);
+ $content = "";
+ foreach ($pathinfo AS $value) {
+ if (substr(strtolower($value), 0, 4) == "url=")
+ $content = substr($value, 4);
+ }
+ if ($content != "") {
+ $siteinfo = parseurl_getsiteinfo($content);
+ return($siteinfo);
+ }
+ }
+ }
+
//$list = $xpath->query("head/title");
$list = $xpath->query("//title");
foreach ($list as $node)
@@ -236,7 +258,8 @@ function parse_url_content(&$a) {
$str_tags = '';
$textmode = false;
- if(local_user() && intval(get_pconfig(local_user(),'system','plaintext')))
+
+ if(local_user() && (! feature_enabled(local_user(),'richtext')))
$textmode = true;
//if($textmode)
@@ -307,16 +330,26 @@ function parse_url_content(&$a) {
$image = "";
- if(sizeof($siteinfo["images"]) > 0){
- /*
- Execute below code only if image is present in siteinfo
- */
- foreach ($siteinfo["images"] as $imagedata)
- if($textmode)
- $image .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]';
+ if(sizeof($siteinfo["images"]) > 0){
+ /* Execute below code only if image is present in siteinfo */
+
+ $total_images = 0;
+ $max_images = get_config('system','max_bookmark_images');
+ if($max_images === false)
+ $max_images = 2;
else
- $image .= '';
+ $max_images = intval($max_images);
+
+ foreach ($siteinfo["images"] as $imagedata) {
+ if($textmode)
+ $image .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]' . "\n";
+ else
+ $image .= '
';
+ $total_images ++;
+ if($max_images && $max_images >= $total_images)
+ break;
}
+ }
if(strlen($text)) {
if($textmode)