[修改][原創]iframe的bbcode

MODs Released by Other phpbb Sites
非官方認證通過之 MOD ,或許有安全性之疑慮,所有問題由原發表者回覆!

版主: 版主管理群

主題已鎖定
GeniusKiKi
竹貓忠實會員
竹貓忠實會員
文章: 1086
註冊時間: 2003-10-28 14:50

[修改][原創]iframe的bbcode

文章 GeniusKiKi »

原作者:法蘭庫克 frank
參考連結:http://phpbb-tw.net/phpbb/viewtopic.php?t=5708

該篇文章的 iframe 需要指定寬、高
小弟偷偷改了個不用指定寬高的
這樣給那些一般用戶使用會比較方便

其實就是把跟寬高有關的地方拿掉罷了

打開includes/bbcode.php
#-----[ 找到]------------------------------------------
#

代碼: 選擇全部

$bbcode_tpl['email'] = str_replace('{EMAIL}', '\\\1', $bbcode_tpl['email']);
#
#-----[ 加在它後面 ]------------------------------------------
#

代碼: 選擇全部

//iframe join by  法蘭庫克 frank 
        $bbcode_tpl['iframe'] = str_replace('{URL}', '\\\1', $bbcode_tpl['iframe']);
#
#-----[ 找到 ]------------------------------------------
\n#

代碼: 選擇全部

// user@domain.tld code.. 
$patterns[] = "#\[email\]([a-z0-9\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#si"; 
$replacements[] = $bbcode_tpl['email'];
#
#-----[ 加在它後面 ]------------------------------------------
#

代碼: 選擇全部

// [iframe] and [/iframe] code.. 
        $patterns[] = "#\[iframe\](.*?)\[/iframe:$uid\]#si"; 
        $replacements[] = $bbcode_tpl[iframe];
#
#-----[ 找到 ]------------------------------------------
#

代碼: 選擇全部

// [img]image_url_here[/img] code.. 
$text = preg_replace("#\[img\](([a-z]+?)://([^ 

]+?))\[/img\]#si", "[img:$uid]\\\1[/img:$uid]", $text);
#
#-----[ 加在它後面 ]------------------------------------------
#

代碼: 選擇全部

//[iframe] and [/iframe] 
        $text = preg_replace("#\[iframe\](([a-z]+?)://([^, 

]+))\[\/iframe\]#si","[iframe\]\\\1[/iframe:$uid]", $text);
#
#-----[ 打開 templates/your template/bbcode.tpl ]------------------------------------------
#
#
#-----[ 找到 ]------------------------------------------
#

代碼: 選擇全部

<!-- BEGIN email --><a href="mailto:{EMAIL}">{EMAIL}</A><!-- END email -->
#
#-----[ 加在它後面 ]------------------------------------------
#

代碼: 選擇全部

<!-- BEGIN iframe --><iframe marginwidth=0 marginheight=0 src="{URL}" frameborder="0" WIDTH=600 HEIGHT=400></iframe><!-- END iframe -->
預設的寬高是 600x400
這樣如果用戶螢幕解析度是 1024x768
搭配上 phpbb 原本的版面\r
大小差不多剛剛好\r

另外最後那一段也可以改成這樣\r

代碼: 選擇全部

<!-- BEGIN iframe --><iframe marginwidth=0 marginheight=0 src="{URL}" frameborder="0" WIDTH=600 HEIGHT=400></iframe><br /><br /><a href="{URL}" target="_blank" class="postlink">{URL}</a><!-- END iframe -->
這是在 iframe 畫面下方再加上原本的網址連結
這樣使用上會方便許多
主題已鎖定

回到「非官方認證外掛」