[2.0.6] Anchor BBCode

The cleanup is complete. This forum is now read only.

Rating:

Excellent!
4
44%
Very Good
2
22%
Good
1
11%
Fair
0
No votes
Poor
2
22%
 
Total votes: 9

User avatar
WileCoyote
Registered User
Posts: 432
Joined: Sun Jan 15, 2006 7:37 am
Location: Austria
Name: Wolfgang
Contact:

Post by WileCoyote »

I've updated the mod so that BBCode Button Help ist working. I've also updated the Version Number so that the description shows who has fixed and updated the mod.

Code: Select all

############################################################## 
## MOD Title: Anchor BBCode 
## MOD Author: Xore < [email protected] > (Robert Hetzler) http://www.xore.ca 
## MOD Fixes/Updates: mac-rolec, asavage, WileCoyote 
## MOD Description: Anchors for hyperlinking within posts 
## MOD Version: 1.0.4 
## 
## Installation Level: (Easy) 
## Installation Time: 3 Minutes 
## Files To Edit: includes/bbcode.php,  
##                templates/subSilver/bbcode.tpl, 
##                templates/subSilver/posting_body.tpl, 
##                language/lang_english/lang_main.php, 
##                language/lang_english/lang_bbcode.php 
## Included Files: (n/a) 
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes: hyperlink within posts! FAQs! YAY! 
############################################################## 
## MOD History: 
## 
##   2006-09-19 - Version 1.0.4 
##      - Mod Fixed so that BBCode Button Help is shown by WileCoyote 
## 
##   2005-12-04 - Version 1.0.3 
##      - Mod fixed so that it also works with Mozilla/Firefox by asavage  
## 
##   2005-08-14 - Version 1.0.2 
##      - Mod Updated to reflect the *actual* location of the multiple bbcode mod by mac-rolec 
## 
##   2003-10-27 - Version 1.0.1 
##      - Updated to reflect the *actual* location of the multiple bbcode mod 
## 
##   2003-09-26 - Version 1.0.0 
##      - Inspired by a need for coherent faqs, and enhanced by ideas 
##        on the original thread devoted to this type of BBCode. 
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 
# 
# IMPORTANT: you MUST first install the latest version of the Multi Quick BBCode Mod (1.4.0c+). 
# This can be found here: http://www.phpbb.com/phpBB/viewtopic.php?t=145513 
# 

# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/bbcode.php 

# 
#-----[ FIND ]--------------------------------- 
# 
$EMBB_widths = array('' 
$EMBB_values = array('' 

# 
#-----[ IN-LINE FIND ]--------------------------------- 
# 
$EMBB_widths = array('' 


# 
#-----[ IN-LINE AFTER, ADD ]--------------------------------- 
# 
,'60','40','80' 


# 
#-----[ IN-LINE FIND ]--------------------------------- 
# 
$EMBB_values = array('' 


# 
#-----[ IN-LINE AFTER, ADD ]--------------------------------- 
# 
,'Anchor','Goto','Gotopost' 

# 
#-----[ FIND ]------------------------------------------ 
# 
$bbcode_tpl['code_open'] = str_replace('{L_CODE}', $lang['Code'], $bbcode_tpl['code_open']); 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

   $bbcode_tpl['anchor'] = str_replace('{URL}', '%s_\\1', $bbcode_tpl['anchor']); 

   $bbcode_tpl['goto_open_1'] = str_replace('{URL}', '#\\1', $bbcode_tpl['goto_open']); 
   $bbcode_tpl['goto_open_2'] = str_replace('{URL}', '#%s_\\1', $bbcode_tpl['goto_open']); 
   $bbcode_tpl['goto_open_3'] = str_replace('{URL}', '#\\1_\\2', $bbcode_tpl['goto_open']); 

   global $phpEx; 
   $bbcode_tpl['gotopost_open_1'] = str_replace('{URL}', append_sid("viewtopic.$phpEx?p=" . '\\1') . '#\\1', $bbcode_tpl['gotopost_open']); 
   $bbcode_tpl['gotopost_open_2'] = str_replace('{URL}', append_sid("viewtopic.$phpEx?p=" . '\\1') . '#\\1_\\2', $bbcode_tpl['gotopost_open']); 

# 
#-----[ FIND ]------------------------------------------ 
# 
$text = str_replace("[/size:$uid]", $bbcode_tpl['size_close'], $text); 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

   $post_id = ( isset($GLOBALS['postrow'][$GLOBALS['i']]['post_id']) ) ? $GLOBALS['postrow'][$GLOBALS['i']]['post_id'] : ( ( isset($GLOBALS['post_id']) ) ? $GLOBALS['post_id'] : 0 ); 

   // anchor 
   $text = preg_replace("/\[anchor:$uid\]([a-zA-Z]\w*?)\[\/anchor:$uid\]/si", sprintf($bbcode_tpl['anchor'],$post_id), $text); 

   // goto 
   $text = preg_replace("/\[goto=([\d]+?):$uid\]/si", $bbcode_tpl['goto_open_1'], $text); 
   $text = preg_replace("/\[goto=([a-zA-Z]\w*?):$uid\]/si", sprintf($bbcode_tpl['goto_open_2'],$post_id), $text); 
   $text = preg_replace("/\[goto=([\d]+?),([a-zA-Z]\w*?):$uid\]/si", $bbcode_tpl['goto_open_3'], $text); 
   $text = str_replace("[/goto:$uid]", $bbcode_tpl['goto_close'], $text); 

   // goto post 
   $text = preg_replace("/\[gotopost=([\d]+?):$uid\]/si", $bbcode_tpl['gotopost_open_1'], $text); 
   $text = preg_replace("/\[gotopost=([\d]+?),([a-zA-Z]\w*?):$uid\]/si", $bbcode_tpl['gotopost_open_2'], $text); 
   $text = str_replace("[/gotopost:$uid]", $bbcode_tpl['gotopost_close'], $text); 

# 
#-----[ FIND ]------------------------------------------ 
# 
$text = preg_replace("#\[size=([1-2]?[0-9])\](.*?)\[/size\]#si", "[size=\\1:$uid]\\2[/size:$uid]", $text); 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

   // [goto] and [gotopost] and [anchor] 
   $text = preg_replace("#\[anchor\]([a-zA-Z]\w*?)\[/anchor\]#si", "[anchor:$uid]\\1[/anchor:$uid]", $text); 

   $text = preg_replace("#\[goto=([\d]+?)\](.*?)\[/goto\]#si", "[goto=\\1:$uid]\\2[/goto:$uid]", $text); 
   $text = preg_replace("#\[goto=([a-zA-Z]\w*?)\](.*?)\[/goto\]#si", "[goto=\\1:$uid]\\2[/goto:$uid]", $text); 
   $text = preg_replace("#\[goto=([\d]+?),([a-zA-Z]\w*?)\](.*?)\[/goto\]#si", "[goto=\\1,\\2:$uid]\\3[/goto:$uid]", $text); 

   $text = preg_replace("#\[gotopost=([\d]+?)\](.*?)\[/gotopost\]#si", "[gotopost=\\1:$uid]\\2[/gotopost:$uid]", $text); 
   $text = preg_replace("#\[gotopost=([\d]+?),([a-zA-Z]\w*?)\](.*?)\[/gotopost\]#si", "[gotopost=\\1,\\2:$uid]\\3[/gotopost:$uid]", $text); 

# 
#-----[ OPEN ]------------------------------------------ 
# You need to do this for all of your installed template styles 
# 
templates/subSilver/bbcode.tpl 

# 
#-----[ FIND ]------------------------------------------ 
# 
<!-- BEGIN size_close --></span><!-- END size_close --> 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

<!-- BEGIN anchor --><a name="{URL}"></a><!-- END anchor --> 

<!-- BEGIN goto_open --><a href="{URL}"><!-- END goto_open --> 
<!-- BEGIN goto_close --></a><!-- END goto_close --> 

<!-- BEGIN gotopost_open --><a href="{URL}"><!-- END gotopost_open --> 
<!-- BEGIN gotopost_close --></a><!-- END gotopost_close --> 

# 
#-----[ OPEN ]------------------------------------------ 
# You need to do this for all of your installed template styles 
# 
templates/subSilver/posting_body.tpl 

# 
#-----[ FIND ]--------------------------------- 
# 
# NOTE: the actual line to find is MUCH longer, containing all the bbcode tags 
# 
bbtags = new Array( 

# 
#-----[ IN-LINE FIND ]--------------------------------- 
# 
'[url]','[/url]' 

# 
#-----[ IN-LINE AFTER, ADD ]--------------------------------- 
# 
,'[anchor]','[/anchor]','[goto=]','[/goto]','[gotopost=]','[/gotopost]' 


# 
#-----[ OPEN ]------------------------------------------ 
# You need to do this for all installed languages 
# 
language/lang_english/lang_main.php 

# 
#-----[ FIND ]------------------------------------------ 
# Full line in English is: $lang['bbcode_f_help'] = 'Font size: [size=x-small]small text[/size]'; 
# 
$lang['bbcode_f_help'] = 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# You need to do this for all installed languages 
# 
$lang['bbcode_help']['Anchor'] = 'Anchor: [anchor]name[/anchor]'; 
$lang['bbcode_help']['Goto'] = 'Goto: [goto=name]text[/goto] [goto=post]text[/goto] [goto=post,name]text[/goto]'; 
$lang['bbcode_help']['Gotopost'] = 'Gotopost: [gotopost=post]text[/goto] [gotopost=post,name]text[/goto]'; 

# 
#-----[ OPEN ]------------------------------------------ 
# You need to do this for all installed languages 
# 
language/lang_english/lang_bbcode.php 

#-----[ FIND ]------------------------------------------ 
# Full line in English is too long too be included here 
# 
$faq[] = array("How to change the text colour or size", " 

# 
#-----[ AFTER, ADD  ]------------------------------------------ 
# 
// Anchor start 
$faq[] = array("How to make anchors and link inside posts","This board has anchoring and linking within posts enabled.<ul><li>To make anchors within your posts, just specify <b>[anchor]</b><i>anchorname</i><b>[/anchor]</b>.</li><li>To link to that anchor:<ol type=\"1\"><li>From within that post, use <b>[goto=<i>anchorname</i>]</b>text<b>[/goto]</b>.</li><li>From another post on the same page, use <b>[goto=<i>postnum</i>,<i>anchorname</i>]</b>text<b>[/goto]</b>.</li><li>From another post on a different page, use <b>[gotopost=<i>postnum</i>,<i>anchorname</i>]</b>text<b>[/gotopost]</b>.</li></ol></li><li>You can also use goto and gotopost to link to the top of any post:<ol type=\"1\"><li> <b>[goto=<i>postnum</i>]</b>text<b>[/goto]</b> if the other post is on the same page,</li><li>Otherwise use <b>[gotopost=<i>postnum</i>]</b>text<b>[/gotopost]</b></li></ol>.</li></ul>"); 

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM 
Francisco.phpBB
Registered User
Posts: 241
Joined: Fri Dec 03, 2004 2:21 pm
Location: ßrazil (UTC -3)

Re: [2.0.6] Anchor BBCode

Post by Francisco.phpBB »

Gotopost works fine with IE6.
But, with FireFox not.

:twisted: With FireFox it go to correct post, but ... then it jump to a random point in the topic!
asavage
Registered User
Posts: 39
Joined: Sun Dec 04, 2005 8:50 pm
Location: Duvall, Wash.
Name: Al Savage
Contact:

Re: [2.0.6] Anchor BBCode

Post by asavage »

I've been using this MOD for over two years, and it works correctly with Firefox & IE, including jumps to anchors defined within a post. Using the "last" updated version, that is.

An exception is if a topic has a lot of images: some browsers will not properly align the viewport I've found. But on topics that do not contain images, the anchor BBCode MOD works very well.
Regards,
Al S.
Francisco.phpBB
Registered User
Posts: 241
Joined: Fri Dec 03, 2004 2:21 pm
Location: ßrazil (UTC -3)

Re: [2.0.6] Anchor BBCode

Post by Francisco.phpBB »

Please, use IE and Firefox.
Try you the link http://comvir.org/viewtopic.php?p=1953#1953
Message: "Ascpderj: Para onde vamos? Transferência do Mainframe ...".
Sorry, but the message it is in Portuguese.
asavage
Registered User
Posts: 39
Joined: Sun Dec 04, 2005 8:50 pm
Location: Duvall, Wash.
Name: Al Savage
Contact:

Re: [2.0.6] Anchor BBCode

Post by asavage »

Francisco.phpBB wrote:Please, use IE and Firefox.
I do, daily.
This link takes me to a login page. You do not have "read" privilege set for guests, so I cannot go further.
Regards,
Al S.
Francisco.phpBB
Registered User
Posts: 241
Joined: Fri Dec 03, 2004 2:21 pm
Location: ßrazil (UTC -3)

Re: [2.0.6] Anchor BBCode

Post by Francisco.phpBB »

Please, excuse me with 1953 post.
Use IE and Firefox.
Try you the link http://comvir.org/viewtopic.php?p=1956#1956 Message #1 (Firefox OK)
Try you the link http://comvir.org/viewtopic.php?p=1957#1957 Message #2 (Firefox NOT OK)
Post Reply

Return to “[2.0.x] MOD Database Cleanup”