X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fparse_url.php;h=15a6aced0e0fda8fcff6d765c17aea3cf94baa00;hb=2a578478167174b328352e0eafe8a4fdbe0fb68d;hp=1561eb8a3ba143d1cf992845b092d7e14d20ea88;hpb=ddec422de6707809aceb541e1191073b43aec18a;p=friendica.git
diff --git a/mod/parse_url.php b/mod/parse_url.php
index 1561eb8a3b..15a6aced0e 100644
--- a/mod/parse_url.php
+++ b/mod/parse_url.php
@@ -2,22 +2,36 @@
require_once('library/HTML5/Parser.php');
-
function parse_url_content(&$a) {
- $url = trim($_GET['url']);
+ logger('parse_url: ' . $_GET['url']);
+
+ $url = trim(hex2bin($_GET['url']));
+
+ logger('parse_url: ' . $url);
$text = null;
- $template = "%s%s";
+ $template = "%s\n%s";
+
+
+ $arr = array('url' => $url, 'text' => '');
+
+ call_hooks('parse_link', $arr);
- if($url)
+ if(strlen($arr['text'])) {
+ echo $arr['text'];
+ killme();
+ }
+
+ if($url) {
$s = fetch_url($url);
- else {
+ } else {
echo '';
killme();
}
+
if(! $s) {
echo sprintf($template,$url,$url,'');
killme();
@@ -46,6 +60,8 @@ function parse_url_content(&$a) {
$items = $div->getElementsByTagName('p');
if($items) {
foreach($items as $item) {
+ if($item->getElementsByTagName('script'))
+ continue;
$text = $item->textContent;
$text = strip_tags($text);
if(strlen($text) < 100)
@@ -62,6 +78,8 @@ function parse_url_content(&$a) {
$items = $dom->getElementsByTagName('p');
if($items) {
foreach($items as $item) {
+ if($item->getElementsByTagName('script'))
+ continue;
$text = $item->textContent;
$text = strip_tags($text);
if(strlen($text) < 100)
@@ -78,4 +96,4 @@ function parse_url_content(&$a) {
echo sprintf($template,$url,$title,$text);
killme();
-}
\ No newline at end of file
+}