vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Custom BBCode for this? (https://vborg.vbsupport.ru/showthread.php?t=307648)

pjkcards 01-29-2014 09:01 AM

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.

kh99 01-29-2014 11:44 AM

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.

kh99 01-29-2014 02:07 PM

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.

pjkcards 02-02-2014 09:35 AM

Quote:

Originally Posted by kh99 (Post 2477691)
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 (Post 2477720)
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.

kh99 02-03-2014 01:06 PM

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'
);


pjkcards 02-04-2014 08:55 AM

That worked, many thanks.


All times are GMT. The time now is 07:58 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01023 seconds
  • Memory Usage 1,740KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete