Хак заменяет Плеер Ютюба на JW Player
Вставляется просто ссылка
[youtube=http://www.youtube.com/watch?v=Nzmp10Ym2bQ]
картинка сама поставится. =)
Авор: kavadims
DEMO: http://www.goldaccordion.com/test_video.html
Ставится для версии 7.5 и ниже... для версии выше 7.5 нужно просто чуток заменить кода, но там все понятно я думаю будет.. =)
1. В /engine/classes/parse.class.php
Находим:
Ниже добавляем:
--------------------------
Находим:
Ниже добавляем:
--------------------------
Находим:
Ниже добавляем:
Скачать и загрузить в папку /engine/classes/
]
Находим:
$source = preg_replace( "#\[audio\s*=\s*(\S.+?)\s*\]#ie", "\$this->build_audio('\\1')", $source );
Ниже добавляем:
$source = preg_replace( "#\[youtube=([^\]]+)\]#ies", "\$this->build_youtube('\\1')", $source );
--------------------------
Находим:
$txt = preg_replace( "#<!--dle_audio_begin:(.+?)-->(.+?)<!--dle_audio_end-->#is", '[audio=\\1]', $txt );
Ниже добавляем:
$txt = preg_replace( "#<!--dle_youtube_begin:(.+?)-->(.+?)<!--dle_youtube_end-->#is", '[youtube=\\1]', $txt );
--------------------------
Находим:
function build_email($url = array()) {
$url['html'] = $this->clear_url( $url['html'] );
$url['show'] = stripslashes( $url['show'] );
return "<a href=\"mailto:{$url['html']}\">{$url['show']}</a>";
}
$url['html'] = $this->clear_url( $url['html'] );
$url['show'] = stripslashes( $url['show'] );
return "<a href=\"mailto:{$url['html']}\">{$url['show']}</a>";
}
Ниже добавляем:
function build_youtube($url) {
$url = $this->clear_url( urldecode( $url ) );
$url = str_replace("&","&", $url );
if( $url == "" ) return;
$source = parse_url ( $url );
$source['host'] = str_replace( "www.", "", strtolower($source['host']) );
if ($source['host'] != "youtube.com" ) return "[youtube=".$url."]";
$a = explode('&', $source['query']);
$i = 0;
while ($i < count($a)) {
$b = split('=', $a[$i]);
if ($b[0] == "v") $video_link = $b[1];
$i++;
}
if ($source['host'] == "youtube.com")
return '<!--dle_youtube_begin:'.$url.'--><script type=\"text/javascript\" src=\"http://www.SITE.com/engine/classes/palyer/swfobject.js\"></script>
<div id=\"mediaspace\">This text will be replaced</div>
<script type=\"text/javascript\">
var so = new SWFObject(\"http://www.SITE.com/engine/classes/palyer/player.swf\",\"mpl\",\"520\",\"400\",\"9\");
so.addParam(\"allowfullscreen\",\"true\");
so.addParam(\"allowscriptaccess\",\"always\");
so.addParam(\"wmode\",\"opaque\");
so.addVariable(\"file\",\"http://www.youtube.com/watch?v='.$video_link.'\");
so.addVariable(\"image\",\"http://i3.ytimg.com/vi/'.$video_link.'/hqdefault.jpg\");
so.addVariable(\"skin\",\"http://www.SITE.com/engine/classes/palyer/skins/modieus.swf\");
so.write(\"mediaspace\");
</script><!--dle_youtube_end-->';
}
$url = $this->clear_url( urldecode( $url ) );
$url = str_replace("&","&", $url );
if( $url == "" ) return;
$source = parse_url ( $url );
$source['host'] = str_replace( "www.", "", strtolower($source['host']) );
if ($source['host'] != "youtube.com" ) return "[youtube=".$url."]";
$a = explode('&', $source['query']);
$i = 0;
while ($i < count($a)) {
$b = split('=', $a[$i]);
if ($b[0] == "v") $video_link = $b[1];
$i++;
}
if ($source['host'] == "youtube.com")
return '<!--dle_youtube_begin:'.$url.'--><script type=\"text/javascript\" src=\"http://www.SITE.com/engine/classes/palyer/swfobject.js\"></script>
<div id=\"mediaspace\">This text will be replaced</div>
<script type=\"text/javascript\">
var so = new SWFObject(\"http://www.SITE.com/engine/classes/palyer/player.swf\",\"mpl\",\"520\",\"400\",\"9\");
so.addParam(\"allowfullscreen\",\"true\");
so.addParam(\"allowscriptaccess\",\"always\");
so.addParam(\"wmode\",\"opaque\");
so.addVariable(\"file\",\"http://www.youtube.com/watch?v='.$video_link.'\");
so.addVariable(\"image\",\"http://i3.ytimg.com/vi/'.$video_link.'/hqdefault.jpg\");
so.addVariable(\"skin\",\"http://www.SITE.com/engine/classes/palyer/skins/modieus.swf\");
so.write(\"mediaspace\");
</script><!--dle_youtube_end-->';
}
Скачать и загрузить в папку /engine/classes/
]