Auto Youtube Link-Converter{تبدیل لینک یوتوب به نمایش آنلاین}
آخرین زمان حضور: Mar 2015


نگارش: 4.1.2 امتیاز:
نصب شده: 0 بار

زمان انتشار: 2011/04/02 بروزرسانی: هرگز دریافت شده: 11 بار






این پلاگین باعث میشه لینک های یوتوب قابلیت پخش رو داشته باشن به صورت خودکار تبدیل به پلیر میشن:
So basically this is a total easy-to-implement plugin, which converts standard youtube links to video-embeds on the fly without urging users to use the video-button because I think it is unnecessary.
On post display, the plugin checks if the post contains at least 1 youtube link in the form of:
کد:<a href="http://www.youtube.com/watch?v=somecode&some=params">http://www.youtube.com/watch?v=somecode&some=params</a>
and converts them using the default vB video bbcode parser.
Code can be modified to fit your needs, altough there shouldn't be much to add.
If you're the special performance-freak, I'm curious if you can enhance data/query-performance. So let me know if you do.
INSTALL:
- Download attached XML File and import it as an addon.
MANUAL INSTALL:
- Go to your AdminCP > Add-ons & Plug-ins > Add new Plug-in
- Addon: Your choice, "vBulletin" by default
- Hook: "postbit_display_complete"
- Name: Your choice
- Exec order: 5 (default)
- php-code; paste this:
- Plug-in active? Obv. Yes.کد PHP:
$ytpreg = "/<a href=\"https?:\/\/www\.youtube\.com\/watch\?v=([a-zA-Z0-9-_]+)(.*)?\"( target=\"_blank\")?>.*<\/a>/";
if (preg_match_all($ytpreg, $post['message'], $pret)>0 && isset($pret[1])) {
$bbcode = new vB_BbcodeParser($this->registry);
$vids = $pret[1];
$sear = $pret[0];
$repl = array();
foreach ($vids as $v) {
$repl[] = $bbcode->handle_bbcode_video("http://www.youtube.com/watch?v=".$v, "youtube;".$v);
}
$yfix = str_ireplace($sear, $repl, $post['message']);
$post['message'] = $yfix;
}
- Save
That's it.
Now every post containing youtube-links should display the embedded video instead.
Works with any number of youtube-links and any kind of text surrounding them.
Let me know if you have trouble/questions.
//e: And for the lazy people, you can find this as addon xml-file below. Just import as an addon.
علاقه مندی ها (Bookmarks)