aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Linkinfo.php
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-04-21 22:16:57 -0700
committerredmatrix <git@macgirvin.com>2016-04-21 22:16:57 -0700
commita3ce194bf52c6db63513754b0c3e8676928a2cfd (patch)
treef8cc64af5f379c313436663aa9f042b9a556e97b /Zotlabs/Module/Linkinfo.php
parent5a427dcee3ca9bce3fcb5de6a67292a405ee6736 (diff)
downloadvolse-hubzilla-a3ce194bf52c6db63513754b0c3e8676928a2cfd.tar.gz
volse-hubzilla-a3ce194bf52c6db63513754b0c3e8676928a2cfd.tar.bz2
volse-hubzilla-a3ce194bf52c6db63513754b0c3e8676928a2cfd.zip
Some issues discovered with linkinfo module, and update the doco about using object modules in addons; as there were a couple of surprises.
Diffstat (limited to 'Zotlabs/Module/Linkinfo.php')
-rw-r--r--Zotlabs/Module/Linkinfo.php40
1 files changed, 20 insertions, 20 deletions
diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php
index a1008f7c4..ef34bb465 100644
--- a/Zotlabs/Module/Linkinfo.php
+++ b/Zotlabs/Module/Linkinfo.php
@@ -111,7 +111,7 @@ class Linkinfo extends \Zotlabs\Web\Controller {
killme();
}
- $siteinfo = parseurl_getsiteinfo($url);
+ $siteinfo = self::parseurl_getsiteinfo($url);
// If this is a Red site, use zrl rather than url so they get zids sent to them by default
@@ -172,14 +172,14 @@ class Linkinfo extends \Zotlabs\Web\Controller {
}
- function deletexnode(&$doc, $node) {
- $xpath = new DomXPath($doc);
+ public static function deletexnode(&$doc, $node) {
+ $xpath = new \DomXPath($doc);
$list = $xpath->query("//".$node);
foreach ($list as $child)
$child->parentNode->removeChild($child);
}
- function completeurl($url, $scheme) {
+ public static function completeurl($url, $scheme) {
$urlarr = parse_url($url);
if (isset($urlarr["scheme"]))
@@ -207,7 +207,7 @@ class Linkinfo extends \Zotlabs\Web\Controller {
}
- function parseurl_getsiteinfo($url) {
+ public static function parseurl_getsiteinfo($url) {
$siteinfo = array();
@@ -221,22 +221,22 @@ class Linkinfo extends \Zotlabs\Web\Controller {
$body = mb_convert_encoding($body, 'UTF-8', 'UTF-8');
$body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8");
- $doc = new DOMDocument();
+ $doc = new \DOMDocument();
@$doc->loadHTML($body);
- $this->deletexnode($doc, 'style');
- $this->deletexnode($doc, 'script');
- $this->deletexnode($doc, 'option');
- $this->deletexnode($doc, 'h1');
- $this->deletexnode($doc, 'h2');
- $this->deletexnode($doc, 'h3');
- $this->deletexnode($doc, 'h4');
- $this->deletexnode($doc, 'h5');
- $this->deletexnode($doc, 'h6');
- $this->deletexnode($doc, 'ol');
- $this->deletexnode($doc, 'ul');
+ self::deletexnode($doc, 'style');
+ self::deletexnode($doc, 'script');
+ self::deletexnode($doc, 'option');
+ self::deletexnode($doc, 'h1');
+ self::deletexnode($doc, 'h2');
+ self::deletexnode($doc, 'h3');
+ self::deletexnode($doc, 'h4');
+ self::deletexnode($doc, 'h5');
+ self::deletexnode($doc, 'h6');
+ self::deletexnode($doc, 'ol');
+ self::deletexnode($doc, 'ul');
- $xpath = new DomXPath($doc);
+ $xpath = new \DomXPath($doc);
//$list = $xpath->query("head/title");
$list = $xpath->query("//title");
@@ -303,7 +303,7 @@ class Linkinfo extends \Zotlabs\Web\Controller {
foreach ($node->attributes as $attribute)
$attr[$attribute->name] = $attribute->value;
- $src = $this->completeurl($attr["src"], $url);
+ $src = self::completeurl($attr["src"], $url);
$photodata = @getimagesize($src);
if (($photodata) && ($photodata[0] > 150) and ($photodata[1] > 150)) {
@@ -322,7 +322,7 @@ class Linkinfo extends \Zotlabs\Web\Controller {
}
} else {
- $src = $this->completeurl($siteinfo["image"], $url);
+ $src = self::completeurl($siteinfo["image"], $url);
unset($siteinfo["image"]);