78 lines
2.1 KiB
PHP
78 lines
2.1 KiB
PHP
<?php
|
|
echo file_exists('/var/www/virtual/ponytopia.net/htdocs/modules/rp/images/1.small');
|
|
/* $command->cmd = "[yt]0gfniCDbbzg[/yt]";
|
|
echo 'message before parse: '.$command->cmd.'<br />';
|
|
$command->cmd = preg_replace_callback("|\[yt\](.*?)\[\/yt\]|", 'yt', $command->cmd);
|
|
//$command->cmd = preg_replace_callback("|\[yt (.*?)=(.*?) (.*?)=(.*?)\](.*?)\[\/yt\]|", 'yt', $command->cmd);
|
|
|
|
function get_tiny_url($url) {
|
|
$ch = curl_init();
|
|
$timeout = 5;
|
|
curl_setopt($ch,CURLOPT_URL,'http://tinyurl.com/api-create.php?url='.$url);
|
|
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
|
|
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
|
|
$data = curl_exec($ch);
|
|
curl_close($ch);
|
|
return $data;
|
|
}
|
|
function getTitle($Url){
|
|
echo "parse";
|
|
$ustr = parse_url($Url);
|
|
echo "file";
|
|
$ctx = stream_context_create(array(
|
|
'http' => array(
|
|
'timeout' => 10
|
|
)
|
|
)
|
|
);
|
|
$str = file_get_contents($Url, 0, $ctx);
|
|
echo "rest";
|
|
if(strlen($str)>0){
|
|
if(strpos($ustr['host'],'youtu')===FALSE){
|
|
preg_match("/\<title\>(.*)\<\/title\>/",$str,$title);
|
|
}else{
|
|
preg_match('/\<meta property="og\:title" content="(.*)"\>/',$str,$title);
|
|
}
|
|
|
|
if($title[1]!=""){
|
|
unset($Url);
|
|
unset($ustr);
|
|
return $title[1];
|
|
}else{
|
|
unset($ustr);
|
|
return basename($Url);
|
|
}
|
|
}
|
|
}
|
|
|
|
function url($matches) {
|
|
echo getTitle($matches[0]);
|
|
$url = get_tiny_url($matches[0]);
|
|
return '<a href="'.$url.'" target="_blank">'.$url.'</a>';
|
|
}
|
|
echo 'message after parse: '.$command->cmd.'<br />';
|
|
|
|
|
|
function yt($matches) {
|
|
global $session,$config,$db,$tpl,$log,$core;
|
|
|
|
var_dump($matches);
|
|
if($matches[1]=='h'){
|
|
$height=$matches[2];
|
|
$width=$matches[4];
|
|
$url=$matches[5];
|
|
}elseif($matches[1]=='w'){
|
|
$height=$matches[4];
|
|
$width=$matches[2];
|
|
$url=$matches[5];
|
|
}elseif($matches[2]==''){
|
|
$height=315;
|
|
$width=560;
|
|
$url=$matches[1];
|
|
}else{
|
|
return $matches[0];
|
|
}
|
|
|
|
return '<iframe width="'.$width.'" height="'.$height.'" src="http://www.youtube.com/embed/'.$url.'" frameborder="0" allowfullscreen></iframe>';
|
|
}*/
|
|
?>
|