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

Custom BbCodes Framework [Deleted]

Discussion in 'Add-on Tips and Guides' started by cclaerhout, Jan 28, 2013.

  1. cclaerhout

    cclaerhout Well-Known Member

    ArnyVee likes this.
  2. ArnyVee

    ArnyVee Well-Known Member

    This is going to help a lot of people. Thanks for doing this Cedric (y)
     
    cclaerhout likes this.
  3. MOZ

    MOZ Well-Known Member

    I going to ho ahead and reply in advance. I know this is probably going to be epic and very helpful like everything else you posted so far on this forum.
     
    cclaerhout likes this.
  4. cclaerhout

    cclaerhout Well-Known Member

    Useful codes

    > To get the visitor object
    PHP:
    $visitor XenForo_Visitor::getInstance();

    > To get the XenForo Options object
    PHP:
    $options XenForo_Application::get('options');
    For example, if you want the board url after this, just use $options->boardUrl

    > To use XenForo phrases
    PHP:
    $myPhrase = new XenForo_Phrase('MyPhrase');
    If you get a phrase by this way, the phrase parameter "Cache this phrase globally" must be checked to prevent extra sql request

    > To debug a variable
    PHP:
    Zend_Debug::dump($variableToCheck);
    > To check if the content is an html image or a XenForo image attachment id
    PHP:
        $regex_attach_direct_id '#^\d+$#';
        
    $regex_attach_parsedimg '#<img.+?src="(.+?)"#ui';
     
        if(
    preg_match($regex_attach_direct_id$content$id))
        {
            
    //Content is an id and should be an attachement id
            
    $content XenForo_Link::buildPublicLink('attachments', array('attachment_id' => $id[0]));
        }
        elseif(
    preg_match($regex_attach_parsedimg$content$src))
        {
            
    //Content is a img url
            
    $content $src[1];
        }

    > To get a XenForo display property
    PHP:
    $myXenProperty XenForo_Template_Helper_Core::styleProperty('myXenProperty');
    $marginright XenForo_Template_Helper_Core::styleProperty('myXenProperty.margin-right');
    I'm also using my own helper to get the color format I want for a property. See the code here.
     
  5. cclaerhout

    cclaerhout Well-Known Member

    The PHP demo file with a few extra which might help you.
     

    Attached Files:

  6. cclaerhout

    cclaerhout Well-Known Member

    Luxus likes this.
  7. cclaerhout

    cclaerhout Well-Known Member

  8. cclaerhout

    cclaerhout Well-Known Member

    This resource has been removed and is no longer available for download.
     

Share This Page