Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-29-2014, 09:01 AM
pjkcards pjkcards is offline
 
Join Date: Jul 2007
Posts: 299
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Custom BBCode for this?

What would be the best way to implement this suggestion?
[removed]

The parameter needs underscores between each letter, as shown in the example. Thanks.
Reply With Quote
  #2  
Old 01-29-2014, 11:44 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You could try this: create a new plugin using hook location bbcode_create and this code:

Code:
if (!function_exists('handle_bbcode_alg'))
{
	function handle_bbcode_alg(&$parser, $code, $option='')
	{
		$param = str_replace(array(' ', '"', "'"), array('_', '', ''), $code);
		return '<a href="http://alg.garron.us/?alg='.$param.'">'.$code.'</a>';
	}
}
$this->tag_list['no_option']['alg'] = array(
	'callback' => 'handle_external',
	'strip_empty' => true,
	'stop_parse' => true,
	'disable_smilies' => true,
	'disable_wordwrap' => true,
	'strip_space_after' => 1,
	'external_callback' => 'handle_bbcode_alg'
);

if you want to add a button in the editor for that code, you can go to the bbcode manager and create a bbcode with code alg. Set "Use {option}" to No and enter your button image, but you can put in whatever you want for the html replacement and the other settings, since they won't be used.
Reply With Quote
  #3  
Old 01-29-2014, 02:07 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Another way might be to installl this mod: https://vborg.vbsupport.ru/showthread.php?t=264896 (a very cool mod which I'm surprised has gotten more attention), then just use the bbcode manager to create a new bbcode, and put the php in the html replacement box, like:
PHP Code:
<?php
        $p 
str_replace(array(' ''"'"'"), array('_'''''), $param);
        return 
'<a href="http://alg.garron.us/?alg='.$p.'">'.$param.'</a>';
and just to be clear, you then don't need to create any plugins or change anything else.

BTW, I haven't test this, so if you decide to try this way and it doesn't work, let us know.
Reply With Quote
  #4  
Old 02-02-2014, 09:35 AM
pjkcards pjkcards is offline
 
Join Date: Jul 2007
Posts: 299
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
You could try this: create a new plugin using hook location bbcode_create and this code:

Code:
if (!function_exists('handle_bbcode_alg'))
{
	function handle_bbcode_alg(&$parser, $code, $option='')
	{
		$param = str_replace(array(' ', '"', "'"), array('_', '', ''), $code);
		return '<a href="http://alg.garron.us/?alg='.$param.'">'.$code.'</a>';
	}
}
$this->tag_list['no_option']['alg'] = array(
	'callback' => 'handle_external',
	'strip_empty' => true,
	'stop_parse' => true,
	'disable_smilies' => true,
	'disable_wordwrap' => true,
	'strip_space_after' => 1,
	'external_callback' => 'handle_bbcode_alg'
);

if you want to add a button in the editor for that code, you can go to the bbcode manager and create a bbcode with code alg. Set "Use {option}" to No and enter your button image, but you can put in whatever you want for the html replacement and the other settings, since they won't be used.
I tried this, but it removed the ' from R' so the URL just had R. The R' has to be R- in the link, as shown in the example in the link I posted.

Quote:
Originally Posted by kh99 View Post
Another way might be to installl this mod: https://vborg.vbsupport.ru/showthread.php?t=264896 (a very cool mod which I'm surprised has gotten more attention), then just use the bbcode manager to create a new bbcode, and put the php in the html replacement box, like:
PHP Code:
<?php
        $p 
str_replace(array(' ''"'"'"), array('_'''''), $param);
        return 
'<a href="http://alg.garron.us/?alg='.$p.'">'.$param.'</a>';
and just to be clear, you then don't need to create any plugins or change anything else.

BTW, I haven't test this, so if you decide to try this way and it doesn't work, let us know.
Once I did this, and used the tag, nothing shows up in the post. It just shows up as blank. Additionally, se the comment above about R' needing to show as R- in the link (see example in link).

Thanks guys. Further help would be much appreciated.
Reply With Quote
  #5  
Old 02-03-2014, 01:06 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, I got thinking about removing quotes and forgot that a single quote was part of the "code". So anyway, try this:
Code:
if (!function_exists('handle_bbcode_alg'))
{
	function handle_bbcode_alg(&$parser, $code, $option='')
	{
		$param = str_replace(array(' ', "'"), array('_', '-'), $code);
		return '<a href="http://alg.garron.us/?alg='.$param.'">'.$code.'</a>';
	}
}
$this->tag_list['no_option']['alg'] = array(
	'callback' => 'handle_external',
	'strip_empty' => true,
	'stop_parse' => true,
	'disable_smilies' => true,
	'disable_wordwrap' => true,
	'strip_space_after' => 1,
	'external_callback' => 'handle_bbcode_alg'
);
Reply With Quote
  #6  
Old 02-04-2014, 08:55 AM
pjkcards pjkcards is offline
 
Join Date: Jul 2007
Posts: 299
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That worked, many thanks.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:52 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05169 seconds
  • Memory Usage 2,220KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete