parse_url changes for oembed/zvideo/etc.
This commit is contained in:
parent
848274bb30
commit
d6ce32ef78
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
require_once('include/oembed.php');
|
||||||
|
|
||||||
/* To-Do
|
/* To-Do
|
||||||
https://developers.google.com/+/plugins/snippet/
|
https://developers.google.com/+/plugins/snippet/
|
||||||
@ -250,6 +251,8 @@ function parse_url_content(&$a) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger('parse_url: ' . $url);
|
||||||
|
|
||||||
$result = z_fetch_url($url,false,0,array('novalidate' => true, 'nobody' => true));
|
$result = z_fetch_url($url,false,0,array('novalidate' => true, 'nobody' => true));
|
||||||
if($result['success']) {
|
if($result['success']) {
|
||||||
$hdrs=array();
|
$hdrs=array();
|
||||||
@ -261,25 +264,31 @@ function parse_url_content(&$a) {
|
|||||||
if (array_key_exists('Content-Type', $hdrs))
|
if (array_key_exists('Content-Type', $hdrs))
|
||||||
$type = $hdrs['Content-Type'];
|
$type = $hdrs['Content-Type'];
|
||||||
if($type) {
|
if($type) {
|
||||||
if(in_array($type,array('image/jpeg','image/gif','image/png'))) {
|
$zrl = is_matrix_url($url);
|
||||||
$s = $br . '[img]' . $url . '[/img]' . $br;
|
if(stripos($type,'image/') !== false) {
|
||||||
$s = preg_replace_callback('/\[img(.*?)\](.*?)\[\/img\]/ism','red_zrlify_img_callback',$s);
|
if($zrl)
|
||||||
echo $s;
|
echo $br . '[zmg]' . $url . '[/zmg]' . $br;
|
||||||
|
else
|
||||||
|
echo $br . '[img]' . $url . '[/img]' . $br;
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
if(stripos($type,'video/') !== false) {
|
if(stripos($type,'video/') !== false) {
|
||||||
echo $br . '[video]' . $url . '[/video]' . $br;
|
if($zrl)
|
||||||
|
echo $br . '[zvideo]' . $url . '[/zvideo]' . $br;
|
||||||
|
else
|
||||||
|
echo $br . '[video]' . $url . '[/video]' . $br;
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
if(stripos($type,'audio/') !== false) {
|
if(stripos($type,'audio/') !== false) {
|
||||||
echo $br . '[audio]' . $url . '[/audio]' . $br;
|
if($zrl)
|
||||||
|
echo $br . '[zaudio]' . $url . '[/zaudio]' . $br;
|
||||||
|
else
|
||||||
|
echo $br . '[audio]' . $url . '[/audio]' . $br;
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger('parse_url: ' . $url);
|
|
||||||
|
|
||||||
$template = $br . '#^[url=%s]%s[/url]%s' . $br;
|
$template = $br . '#^[url=%s]%s[/url]%s' . $br;
|
||||||
|
|
||||||
$arr = array('url' => $url, 'text' => '');
|
$arr = array('url' => $url, 'text' => '');
|
||||||
@ -291,6 +300,11 @@ function parse_url_content(&$a) {
|
|||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$x = oembed_process($url);
|
||||||
|
if($x) {
|
||||||
|
echo $x;
|
||||||
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
if($url && $title && $text) {
|
if($url && $title && $text) {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user