1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XenForo unable to find class, even though it exists

Discussion in 'XenForo Development Discussions' started by tssge, Oct 16, 2014.

  1. tssge

    tssge Member

    Hello,

    I'm having a problem with XenForo and my plugin which extends a XenForo class. XenForo will output
    Code:
    Fatal error: Class 'LazyLoad_XenForo_BbCode_Formatter_Base' not found in /srv/www/test.mineskene.fi/httpdocs/library/XenForo/BbCode/Formatter/Base.php on line 1923
    Even though this class exists.

    library/LazyLoad/Listener.php
    PHP:
    <?php

    class LazyLoad_Listener {

        
    /**
         * Instruct the system that XenForo_BbCode_Formatter_Base
         * should be extended by LazyLoad_BbCode_Formatter_Base
         *
         * @param string $class
         * @param array $extend
         */
         
    public static function extendBbCodeFormatter($class, array &$extend) {
            if(
    $class == 'XenForo_BbCode_Formatter_Base')
                
    $extend[] = 'LazyLoad_XenForo_BbCode_Formatter_Base';
         }
        
        
    /**
         * Instruct the system that XenForo_ProxyOutput
         * should be extended by LazyLoad_ProxyOutput
         *
         * @param string $class
         * @param array $extend
         */
        
    public static function extendImageProxyOutput($class, array &$extend) {
            if(
    $class == 'XenForo_ProxyOutput')
                
    $extend[] = 'LazyLoad_ProxyOutput';
        }
    }
    library/LazyLoad/Xenforo/BbCode/Formatter/Base.php
    PHP:
    <?php

    class LazyLoad_XenForo_BbCode_Formatter_Base extends XFCP_LazyLoad_XenForo_BbCode_Formatter_Base {

        
    /**
         * Renders a img tag.
         *
         * @param array $tag Information about the tag reference; keys: tag, option, children
         * @param array $rendererStates Renderer states to push down
         *
         * @return string Rendered tag
         */
        
    public function renderTagImage(array $tag, array $rendererStates)
        {
            
    $response parent::renderTagImage($tag$renderStates);
           
            return 
    $response;
        }

    }
    Code Event Listener
    [​IMG]

    What is wrong with this?
     
  2. tssge

    tssge Member

    Hurpa durp. Xenforo needs to be changed to XenForo. Works after that fine.

    I'll leave this thread here in case someone else has the same problem as I did.
     
    SneakyDave likes this.
  3. Chris D

    Chris D XenForo Developer Staff Member

    Many people have already :)

    It's common. Ironically, I was specifically looking for a similar mistake in your code on my mobile as I was walking to go and do something else. I didn't spot it!
     
  4. Milano

    Milano Well-Known Member

    You should use load_class_bb_code for BbCode_Formatter_Base
     
  5. tssge

    tssge Member

    Yeah, I know. I was just thinking that it might be the problem, so I decided to try more general load_class.
     

Share This Page