https://www.icyphoenix.com/viewtopic.php?f=4&t=2245
-----------------------------------
moreteavicar
Fri 08 Jun, 2007 14:48

BBCODE - How To Use Icy Phoenix Customized bbcode.php
-----------------------------------
In bbcode.php there are instructions from MG for usage of the re-written bbcode.php file. For instance, when parsing, using:
[codeblock]
$text = $bbcode->parse($text, $bbcode_uid);
[/codeblock]
When installing a mod which uses:
[codeblock]
bbencode_second_pass($zdesc, $bbcode_uid)
[/codeblock]
I've tried replacing this with 
[codeblock]
$zdesc = $bbcode->parse($zdesc, $bbcode_uid);
[/codeblock]

However, I get an error:
[codeblock]Fatal error: Call to undefined method stdClass::parse()[/codeblock]

This seems strange as the mg modified bbcode.php is being included, which contains the definition of parse - any ideas anybody?

NB I also added some declarations to 'seed' $bbcode before parsing:
[code]
			$bbcode->allow_html = $html_on;
			$bbcode->allow_bbcode = true;
			if ( !$lofi )
			{    
				$bbcode->allow_smilies = true;
			}
			else
			{
				$bbcode->allow_smilies = false;
			}   			

[/code]		
However, these make no difference, I get the same parse error if I comment them out.


-----------------------------------
moreteavicar
Fri 08 Jun, 2007 14:55

Re: [BBcodes]How to use the Bicet / MG customised bbcode.php
-----------------------------------
Also, I've tried:

[code]$zdesc = bbcode_killer_mg($zdesc, $bbcode_uid);[/code]
and 
[code]$zdesc = bbcuid_killer_mg($zdesc, $bbcode_uid);[/code]

These do not result in errors, but they also do not parse the bbcode either!


-----------------------------------
Mighty Gorgon
Sun 10 Jun, 2007 04:45

Re: [BBcodes]How to use the Bicet / MG customised bbcode.php
-----------------------------------
You have some examples on top of bbcode.php:

[codeblock]/*

=================
Includes
=================

include($phpbb_root_path . 'includes/bbcode.' . $phpEx);

=================
Globals
=================

global $bbcode;

=================
BBCode Parsing
=================

$text = $bbcode->parse($text, $bbcode_uid);

=================
BBCode Conditions
=================

$bbcode->allow_html = ( $userdata['user_allowhtml'] && $board_config['allow_html'] ) ? true : false;
$bbcode->allow_bbcode = ( $userdata['user_allowbbcode'] && $board_config['allow_bbcode'] ) ? true : false;
$bbcode->allow_smilies = ( $userdata['user_allowsmile'] && $board_config['allow_smilies'] ) ? true : false;

=================

$html_on = ( $userdata['user_allowhtml'] && $board_config['allow_html'] ) ? 1 : 0 ;
$bbcode_on = ( $userdata['user_allowbbcode'] && $board_config['allow_bbcode'] ) ? 1 : 0 ;
$smilies_on = ( $userdata['user_allowsmile'] && $board_config['allow_smilies'] ) ? 1 : 0 ;

$bbcode->allow_html = $html_on;
$bbcode->allow_bbcode = $bbcode_on;
$bbcode->allow_smilies = $smilies_on;

=================

$bbcode->allow_html = ( $board_config['allow_html'] ? $board_config['allow_html'] : false );
$bbcode->allow_bbcode = ( $board_config['allow_bbcode'] ? $board_config['allow_bbcode'] : false );
$bbcode->allow_smilies = ( $board_config['allow_smilies'] ? $board_config['allow_smilies'] : false );

=================

$bbcode->allow_html = $board_config['allow_html'];
$bbcode->allow_bbcode = $board_config['allow_bbcode'];
$bbcode->allow_smilies = $board_config['allow_smilies'];

=================

$bbcode->allow_html = ( ($board_config['allow_html'] && $row['enable_bbcode']) ? true : false );
$bbcode->allow_bbcode = ( ($board_config['allow_bbcode'] && $row['enable_bbcode']) ? true : false );
$bbcode->allow_smilies = ( ($board_config['allow_smilies'] && $row['enable_smilies']) ? true : false );

=================

$bbcode->allow_html = ( $board_config['allow_html'] && $postrow[$i]['enable_bbcode'] ? true : false );
$bbcode->allow_bbcode = ( $board_config['allow_bbcode'] && $postrow[$i]['enable_bbcode'] ? true : false );
$bbcode->allow_smilies = ( $board_config['allow_smilies'] && $postrow[$i]['enable_smilies'] ? true : false );

=================

$bbcode->allow_smilies = ( $board_config['allow_smilies'] ? $board_config['allow_smilies'] : false );
$bbcode->allow_bbcode = ( $board_config['allow_bbcode'] ? $board_config['allow_bbcode'] : false );
//$bbcode->allow_bbcode = ( $bbcode_uid != '' ? $board_config['allow_bbcode'] : false );
=================

=================================
Acronyms, Autolinks, Word Wrap
=================================

$orig_autolink = array();
$replacement_autolink = array();
obtain_autolink_list($orig_autolink, $replacement_autolink, 99999999);
if( function_exists( 'acronym_pass' ) )
{
	$text = acronym_pass( $text );
}
if( count($orig_autolink) )
{
	$text = autolink_transform($text, $orig_autolink, $replacement_autolink);
}
$text = kb_word_wrap_pass ($text);
====================


*/[/codeblock]

You can eventually try to guess the correct way to use it by inspecting some files where it is used... viewtopic, blocks, shoutbox, news...

Finally a small correction.

The original code was developed by CyberAlien, and then ported by me into XS.

Here are a small adaptation on how to use a basic BBCode parsing function into any php file:

http://www.mightygorgon.com/viewtopic.php?t=2778


-----------------------------------
moreteavicar
Sun 10 Jun, 2007 16:06

Re: [BBcodes]How to use the Bicet / MG customised bbcode.php
-----------------------------------
Hi MG, I tried the above, but I get the following:

[quote user="moreteavicar" post="16202"]

[codeblock]Fatal error: Call to undefined method stdClass::parse()[/codeblock]

[/quote]
Which seems strange as bbcode.php is included, which contains the class definition for parse...


-----------------------------------
Mighty Gorgon
Wed 20 Jun, 2007 01:19

Re: [BBcodes]How to use the Bicet / MG customised bbcode.php
-----------------------------------
[quote user="moreteavicar" post="16341"]Hi MG, I tried the above, but I get the following:

[quote user="moreteavicar" post="16202"]

[codeblock]Fatal error: Call to undefined method stdClass::parse()[/codeblock]

[/quote]
Which seems strange as bbcode.php is included, which contains the class definition for parse...[/quote]
It seems you didn't the integration properly.

Try to send me the file you are trying to modify and I'll have a look.


