aboutsummaryrefslogtreecommitdiffstats
path: root/include/network.php
diff options
context:
space:
mode:
authorKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2017-04-03 22:08:32 +0200
committerKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2017-04-15 00:41:42 +0200
commitb6459e617289f729da1372b40f5a35940943f36d (patch)
tree8a27cac30b34a27fd91d426b82d429bef1ed1934 /include/network.php
parentb4f65840d166db6c0244a773e8fe2693cb3f5d2e (diff)
downloadvolse-hubzilla-b6459e617289f729da1372b40f5a35940943f36d.tar.gz
volse-hubzilla-b6459e617289f729da1372b40f5a35940943f36d.tar.bz2
volse-hubzilla-b6459e617289f729da1372b40f5a35940943f36d.zip
:arrow_up: Update SimplePie library.
As a follow up to issue #699 update SimplePie from 1.2.1-dev (around 6years old) to current git master (1.4.4-dev). We use the master branch until the next release because it contains our patch for enclosure titles already. The other patches in the library from us can be done by configuring the SimplePie object in our code instead. Used composer to manage this library and use class autoloading. Add some unit tests for include/feedutils.php, but the interesting parts are unfortunately not testable with the current code.
Diffstat (limited to 'include/network.php')
-rw-r--r--include/network.php25
1 files changed, 19 insertions, 6 deletions
diff --git a/include/network.php b/include/network.php
index 0ef88125b..2d47c5b92 100644
--- a/include/network.php
+++ b/include/network.php
@@ -1078,7 +1078,6 @@ function discover_by_url($url, $arr = null) {
// try and discover stuff from the feeed
- require_once('library/simplepie/simplepie.inc');
$feed = new SimplePie();
$level = 0;
$x = z_fetch_url($guid, false, $level, array('novalidate' => true));
@@ -1093,6 +1092,12 @@ function discover_by_url($url, $arr = null) {
// Don't try and parse an empty string
$feed->set_raw_data(($xml) ? $xml : '<?xml version="1.0" encoding="utf-8" ?><xml></xml>');
+ // We can preserve iframes because we will strip them in the purifier after
+ // checking for supported video sources.
+ $strip_htmltags = $feed->strip_htmltags;
+ array_splice($strip_htmltags, array_search('iframe', $strip_htmltags), 1);
+ $feed->strip_htmltags($strip_htmltags);
+
$feed->init();
if($feed->error())
logger('scrape_feed: Error parsing XML: ' . $feed->error());
@@ -1627,22 +1632,30 @@ function find_webfinger_location($j,$rhs) {
return '';
}
-function match_webfinger_location($s,$h) {
+/**
+ * @brief Match the webfinger location for the different networks.
+ *
+ * @param string $s The string to search in
+ * @param string $h The host
+ * @return string
+ */
+function match_webfinger_location($s, $h) {
// GNU-social and the older StatusNet - the $host/user/123 form doesn't work
- if(preg_match('|' . $h . '/index.php/user/([0-9]*?)$|',$s))
+ if(preg_match('|' . $h . '/index.php/user/([0-9]*?)$|', $s))
return $s;
// Redmatrix / hubzilla
- if(preg_match('|' . $h . '/channel/|',$s))
+ if(preg_match('|' . $h . '/channel/|', $s))
return $s;
// Friendica
- if(preg_match('|' . $h . '/profile/|',$s))
+ if(preg_match('|' . $h . '/profile/|', $s))
return $s;
$arr = array('test' => $s, 'host' => $h, 'success' => false);
- call_hooks('match_webfinger_location',$arr);
+ call_hooks('match_webfinger_location', $arr);
if($arr['success'])
return $s;
+
return '';
}