Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 830601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:04:14+00:00 2026-05-15T04:04:14+00:00

I’m trying to add extra tags to the PEAR package BBCodeParser http://pear.php.net/package/HTML_BBCodeParser/docs/latest/li_HTML_BBCodeParser.html , to

  • 0

I’m trying to add extra tags to the PEAR package BBCodeParser http://pear.php.net/package/HTML_BBCodeParser/docs/latest/li_HTML_BBCodeParser.html, to do this, I believe I need to place Object.php in \php5.3.0\PEAR\pear\HTML\BBCodeParser\Filter and call addFilter.

Object.php

<?php
/*
 New filter
 @todo Lots
*/
require_once 'HTML/BBCodeParser/Filter.php';

class HTML_BB_CodeParser_Filter_Object extends HTML_BBCodeParser_Filter {

var $_definedTags = array( 'object' => array ( 'htmlopen' => 'object',
          'htmlclose' => 'object',
          'allowed' => 'all',
          'attributes' => array()
              )
    )

}
?>

extbbcode.php

<?php
/*
 The test display page
*/
error_reporting(E_STRICT); 
require_once('HTML/BBCodeParser.php');

$parser = new HTML_BBCodeParser();

$parser->addFilter('object');

$parser->setText('[b]bold[/b] [object]test[/object]');
$parser->parse();
$parsed = $parser->getParsed();

echo htmlentities($parsed, ENT_QUOTES). ' | ';
echo $parsed;
?>

When I view extbbcode.php I just get this error

Strict Standards: Non-static method PEAR::getStaticProperty() should not be called statically, assuming $this from incompatible context in D:\wamp\bin\php\php5.3.0\PEAR\pear\HTML\BBCodeParser.php on line 169

If I comment out the $parser->addFilter(‘object’); line then it works as expected, ie, produces valid output. I can also specify an existing filter, ie

$parser->addFilter('basic');
$parser->addFilter('images');

Basic.php , Images.php

If I call addFilter with an invalid filter (ie, the file doesn’t exist) I get the “Failed to load filter $filter” message.

Can someone spot what I’m doing wrong? It seems to me that Object.php is included, but produces those weird STRICT messages. So my problem is definitely with that file.

If anyone has experience with this class or that error message and can point me in the right direction, I’d be very happy 🙂

BBCodeParser.php

function addFilter($filter)
{
    $filter = ucfirst($filter);
    if (!array_key_exists($filter, $this->_filters)) {
        $class = 'HTML_BBCodeParser_Filter_'.$filter;
        @include_once 'HTML/BBCodeParser/Filter/'.$filter.'.php';
        if (!class_exists($class)) {
            PEAR::raiseError("Failed to load filter $filter", null, PEAR_ERROR_DIE);
        }
        $this->_filters[$filter] = new $class;
        $this->_definedTags = array_merge(
            $this->_definedTags,
            $this->_filters[$filter]->_definedTags
        );
    }
}

edit: managed to get PEAR working on my local WAMP, so I can simplify the question by ruling out another problem I was having.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:04:15+00:00Added an answer on May 15, 2026 at 4:04 am

    You can add your filter directly to the BBCode class.

    class HTML_BBCodeParser_Custom_Filter extends HTML_BBCodeParser  
    {  
        var $_definedTags =   
            array('block' => array( 'htmlopen'  => 'blockquote',  
                        'htmlclose' => 'blockquote',  
                        'allowed'   => 'all',  
                        'attributes'=> array()  
                      ),  
                  'line' =>  array( 'htmlopen'  => 'hr',  
                        'htmlclose' => '',  
                        'allowed'   => 'all',  
                        'attributes'=> array()  
                      ),
                );  
    
    }
    
    $BBCodeParser = new HTML_BBCodeParser();
    
    $FilterName = 'Custom_Filter';
    $BBCodeParser->_filters[$FilterName] = new HTML_BBCodeParser_Custom_Filter();
        $BBCodeParser->_definedTags = array_merge(
                $BBCodeParser->_definedTags,
                $BBCodeParser->_filters[$FilterName]->_definedTags);
    
    echo $BBCodeParser->qparse("[block]This is a blockquote. [line][/block]");
    

    Disclosure: The custom tags class were taken from here while the code to put the tags directly into the class were taken from the actual PEAR source code (HTML_BBCodeParser::addfilter).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 407k
  • Answers 407k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try ?amenityTypes=1&amenityTypes=5. May 15, 2026 at 6:35 am
  • Editorial Team
    Editorial Team added an answer You can use something like this: def printTree(tree, depth =… May 15, 2026 at 6:35 am
  • Editorial Team
    Editorial Team added an answer I usually just use ctrl+k, ctrl+d shortcut in Visual Studio… May 15, 2026 at 6:35 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.