embed-videos-met-auto-detectie-voor-fora
Gesponsorde koppelingen
PHP script bestanden
<pre>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
echo embed_video($_POST['video'])."<br/><form method='post'>
<input type=\"text\" style=\"width:600px;\" name=\"video\"/>
<input type=\"submit\" value=\"test\"/>
</form>";
function embed_video($code) {
/*versie 1.0.9*/
$debug=1;
$embeds=array(
/*(naam,verboden_tekens,locatie_code,detectie_url,embed_code_met_[%CODE]_als_code)*/
array("Southpark Video","/[^0-9]/","FOLDER=2","southparkstudios.com","<embed src=\"http://media.mtvnservices.com/mgid:cms:item:Southparkstudios.com:[%CODE]\" type=\"application/x-shockwave-flash\" wmode=\"window\" width=\"480\" height=\"360\" allowFullscreen=\"true\" allowScriptAccess=\"always\"></embed>"),
array("Google Video","/[^0-9\-]/","GET=docid","video.google","<embed id=\"VideoPlayback\" style=\"width:400px;height:326px\" allowFullScreen=\"true\" flashvars=\"fs=true\" src=\"http://video.google.com/googleplayer.swf?docid=[%CODE]&hl=nl\" type=\"application/x-shockwave-flash\"></embed>"),
array("Youtube Video","/[^0-9a-z\-_]/i","GET=v","youtube.com","<embed src=\"http://www.youtube.com/v/[%CODE]&hl=nl\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"355\"></embed>"),
array("Dailymotion Video","/[^0-9a-z]/i","AFTER=video/&BEFORE=_","dailymotion.com","<embed src=\"http://www.dailymotion.com/swf/[%CODE]&related=1\" type=\"application/x-shockwave-flash\" width=\"420\" height=\"365\" allowFullScreen=\"true\" allowScriptAccess=\"always\"></embed>"),
array("Veoh Video","/[^0-9a-z]/i","AFTER=videos/&BEFORE=[AND]&BEFORE2=[Q]","veoh.com","<embed src=\"http://www.veoh.com/veohplayer.swf?permalinkId=[%CODE]&id=anonymous&player=videodetailsembedded&videoAutoPlay=0\" allowFullScreen=\"true\" width=\"410\" height=\"341\" bgcolor=\"#FFFFFF\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed>"),
array("Myvideo Video","/[^0-9]/","AFTER=watch/&BEFORE=?","myvideo.nl","<embed src=\"http://www.myvideo.nl/movie/[%CODE]\" width=\"470\" height=\"406\"></embed>"),
);
foreach($embeds as $embed) {
if(substr_count($code,$embed[3])>0){ //als detectie_url meer dan 0 keer voorkomt in code...
if(get($embed[2],"GET")!=false) //als locatie_code GET is...
{
if($debug==1) echo get($embed[2],"GET")."=".get($code,get($embed[2],"GET"))." uit ".$code."<br/>";;
if(preg_replace($embed[1],"",get($code,get($embed[2],"GET")))==get($code,get($embed[2],"GET")))
return str_replace("[%CODE]",get($code,get($embed[2],"GET")),$embed[4]);
else
return "Code bevat ongeldige tekens!<br/>";
}
elseif(get($embed[2],"FOLDER")!=false) //als locatie_code FOLDER is...
{
if($debug==1) echo "FOLDER ".get($embed[2],"FOLDER")." uit ".$code."<br/>";
$folders=explode($embed[3]."/",$code);
$folders=explode("/",$folders[1]);
if(preg_replace($embed[1],"",$folders[get($embed[2],"FOLDER")-1])==$folders[get($embed[2],"FOLDER")-1])
return str_replace("[%CODE]",$folders[get($embed[2],"FOLDER")-1],$embed[4])."<br/>".$folders[get($embed[2],"FOLDER")-1];
else
return "Code bevat ongeldige tekens!<br/>";
}
elseif(get($embed[2],"AFTER")!=false)
{
$temp=explode(get($embed[2],"AFTER"),$code);
if($temp[1]==null)
return "Code kon niet gevonden worden na ".get($embed[2],"AFTER");
$temp=$temp[1];
if(get($embed[2],"BEFORE")!=null)
{
$temp=explode(get($embed[2],"BEFORE"),$temp);
if($temp[0]==null)
return "Code kon niet gevonden worden na ".get($embed[2],"AFTER")." en voor ".get($embed[2],"BEFORE");
$temp=$temp[0];
}
if(get($embed[2],"BEFORE2")!=null)
{
$temp=explode(get($embed[2],"BEFORE2"),$temp);
if($temp[0]==null)
return "Code kon niet gevonden worden na ".get($embed[2],"AFTER")." en voor ".get($embed[2],"BEFORE2");
$temp=$temp[0];
}
if(preg_replace($embed[1],"",$temp)==$temp)
return str_replace("[%CODE]",$temp,$embed[4])."<br/>".$temp;
else
return "Code bevat ongeldige tekens!<br/>";
}
}
}
return "Geen geldige video gevonden.";
}
function get($string,$request) {
$string=explode("?",$string,2);
if($string[1]==null)
$string=$string[0];
else
$string=$string[1];
$string=explode("&",$string);
foreach($string as $var)
{
$array[]=explode("=",str_replace(array("[AND]","[Q]"),array("&","?"),$var),2);
}
$var=null;
if($request==null)
return $array;
foreach($array as $subarray)
{
if($subarray[0]==$request)
return $subarray[1];
}
return false;
}
?>
echo embed_video($_POST['video'])."<br/><form method='post'>
<input type=\"text\" style=\"width:600px;\" name=\"video\"/>
<input type=\"submit\" value=\"test\"/>
</form>";
function embed_video($code) {
/*versie 1.0.9*/
$debug=1;
$embeds=array(
/*(naam,verboden_tekens,locatie_code,detectie_url,embed_code_met_[%CODE]_als_code)*/
array("Southpark Video","/[^0-9]/","FOLDER=2","southparkstudios.com","<embed src=\"http://media.mtvnservices.com/mgid:cms:item:Southparkstudios.com:[%CODE]\" type=\"application/x-shockwave-flash\" wmode=\"window\" width=\"480\" height=\"360\" allowFullscreen=\"true\" allowScriptAccess=\"always\"></embed>"),
array("Google Video","/[^0-9\-]/","GET=docid","video.google","<embed id=\"VideoPlayback\" style=\"width:400px;height:326px\" allowFullScreen=\"true\" flashvars=\"fs=true\" src=\"http://video.google.com/googleplayer.swf?docid=[%CODE]&hl=nl\" type=\"application/x-shockwave-flash\"></embed>"),
array("Youtube Video","/[^0-9a-z\-_]/i","GET=v","youtube.com","<embed src=\"http://www.youtube.com/v/[%CODE]&hl=nl\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"355\"></embed>"),
array("Dailymotion Video","/[^0-9a-z]/i","AFTER=video/&BEFORE=_","dailymotion.com","<embed src=\"http://www.dailymotion.com/swf/[%CODE]&related=1\" type=\"application/x-shockwave-flash\" width=\"420\" height=\"365\" allowFullScreen=\"true\" allowScriptAccess=\"always\"></embed>"),
array("Veoh Video","/[^0-9a-z]/i","AFTER=videos/&BEFORE=[AND]&BEFORE2=[Q]","veoh.com","<embed src=\"http://www.veoh.com/veohplayer.swf?permalinkId=[%CODE]&id=anonymous&player=videodetailsembedded&videoAutoPlay=0\" allowFullScreen=\"true\" width=\"410\" height=\"341\" bgcolor=\"#FFFFFF\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed>"),
array("Myvideo Video","/[^0-9]/","AFTER=watch/&BEFORE=?","myvideo.nl","<embed src=\"http://www.myvideo.nl/movie/[%CODE]\" width=\"470\" height=\"406\"></embed>"),
);
foreach($embeds as $embed) {
if(substr_count($code,$embed[3])>0){ //als detectie_url meer dan 0 keer voorkomt in code...
if(get($embed[2],"GET")!=false) //als locatie_code GET is...
{
if($debug==1) echo get($embed[2],"GET")."=".get($code,get($embed[2],"GET"))." uit ".$code."<br/>";;
if(preg_replace($embed[1],"",get($code,get($embed[2],"GET")))==get($code,get($embed[2],"GET")))
return str_replace("[%CODE]",get($code,get($embed[2],"GET")),$embed[4]);
else
return "Code bevat ongeldige tekens!<br/>";
}
elseif(get($embed[2],"FOLDER")!=false) //als locatie_code FOLDER is...
{
if($debug==1) echo "FOLDER ".get($embed[2],"FOLDER")." uit ".$code."<br/>";
$folders=explode($embed[3]."/",$code);
$folders=explode("/",$folders[1]);
if(preg_replace($embed[1],"",$folders[get($embed[2],"FOLDER")-1])==$folders[get($embed[2],"FOLDER")-1])
return str_replace("[%CODE]",$folders[get($embed[2],"FOLDER")-1],$embed[4])."<br/>".$folders[get($embed[2],"FOLDER")-1];
else
return "Code bevat ongeldige tekens!<br/>";
}
elseif(get($embed[2],"AFTER")!=false)
{
$temp=explode(get($embed[2],"AFTER"),$code);
if($temp[1]==null)
return "Code kon niet gevonden worden na ".get($embed[2],"AFTER");
$temp=$temp[1];
if(get($embed[2],"BEFORE")!=null)
{
$temp=explode(get($embed[2],"BEFORE"),$temp);
if($temp[0]==null)
return "Code kon niet gevonden worden na ".get($embed[2],"AFTER")." en voor ".get($embed[2],"BEFORE");
$temp=$temp[0];
}
if(get($embed[2],"BEFORE2")!=null)
{
$temp=explode(get($embed[2],"BEFORE2"),$temp);
if($temp[0]==null)
return "Code kon niet gevonden worden na ".get($embed[2],"AFTER")." en voor ".get($embed[2],"BEFORE2");
$temp=$temp[0];
}
if(preg_replace($embed[1],"",$temp)==$temp)
return str_replace("[%CODE]",$temp,$embed[4])."<br/>".$temp;
else
return "Code bevat ongeldige tekens!<br/>";
}
}
}
return "Geen geldige video gevonden.";
}
function get($string,$request) {
$string=explode("?",$string,2);
if($string[1]==null)
$string=$string[0];
else
$string=$string[1];
$string=explode("&",$string);
foreach($string as $var)
{
$array[]=explode("=",str_replace(array("[AND]","[Q]"),array("&","?"),$var),2);
}
$var=null;
if($request==null)
return $array;
foreach($array as $subarray)
{
if($subarray[0]==$request)
return $subarray[1];
}
return false;
}
?>
</pre>