diff options
Diffstat (limited to 'include/network.php')
-rw-r--r-- | include/network.php | 25 |
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 ''; } |