Nikolaos
Member
Hello,
 
I have made several edits to the BBcode related scripts in order to accommodate special ordered lists, such as:
 
I. foo
II. bar
 
But, I am running into trouble with the HTML interpretation.
 
Here is what I did in /library/XenForo/Html/Renderer/BbCode.php:, which is throwing the error:
 
	
	
	
		
 
Here is the referenced handleTagOl:
 
	
	
	
		
 
The error thrown (when trying to preview the post) is as follows:
 
I don't see where it is going wrong. Could anyone enlighten me?
				
			I have made several edits to the BBcode related scripts in order to accommodate special ordered lists, such as:
I. foo
II. bar
But, I am running into trouble with the HTML interpretation.
Here is what I did in /library/XenForo/Html/Renderer/BbCode.php:, which is throwing the error:
		PHP:
	
	    protected $_handlers = array(
        'b'          => array('wrap' => '[B]%s[/B]'),
        'strong'     => array('wrap' => '[B]%s[/B]'),
        [...]
        'a'          => array('filterCallback' => array('$this', 'handleTagA')),
        'img'        => array('filterCallback' => array('$this', 'handleTagImg')),
        'ul'         => array('wrap' => "[LIST]\n%s\n[/LIST]", 'skipCss' => true),
        // Following line is edited
        'ol'         => array('filterCallback' => array('$this', 'handleTagOl')),
        'li'         => array('filterCallback' => array('$this', 'handleTagLi')),
        [...]Here is the referenced handleTagOl:
		PHP:
	
	    public function handleTagOl($text, XenForo_Html_Tag $tag)
    {
        $listType = trim($tag->attribute('style'));
        if($listType)
        {
            if(preg_match('/^list-style-type: decimal/', $listType))
                $target = '1';
            elseif(preg_match('/^list-style-type: lower-alpha', $listType))
                $target = 'a';
            elseif(preg_match('/^list-style-type: upper-alpha', $listType))
                $target = 'A';
            elseif(preg_match('/^list-style-type: lower-roman', $listType))
                $target = 'i';
            elseif(preg_match('/^list-style-type: upper-roman', $listType))
                $target = 'I';
            return "[LIST=$target]{$text}[/LIST]";
        }
        else return "[LIST=1]{$text}[/LIST]";
    }The error thrown (when trying to preview the post) is as follows:
The following error occurred:
Array to string conversion
- XenForo_Application::handlePhpError() in XenForo/Html/Renderer/BbCode.php at line 478
- XenForo_Html_Renderer_BbCode->handleTagOl() in XenForo/Html/Renderer/BbCode.php at line 259
- XenForo_Html_Renderer_BbCode->renderTag() in XenForo/Html/Renderer/BbCode.php at line 339
- XenForo_Html_Renderer_BbCode->renderChildren() in XenForo/Html/Renderer/BbCode.php at line 145
- XenForo_Html_Renderer_BbCode->renderTag() in XenForo/Html/Renderer/BbCode.php at line 120
- XenForo_Html_Renderer_BbCode->render() in XenForo/Html/Renderer/BbCode.php at line 92
- XenForo_Html_Renderer_BbCode::renderFromHtml() in XenForo/ControllerHelper/Editor.php at line 89
- XenForo_ControllerHelper_Editor->convertEditorHtmlToBbCode() in XenForo/ControllerPublic/Editor.php at line 46
- XenForo_ControllerPublic_Editor->actionToBbCode() in XenForo/FrontController.php at line 310
- XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
- XenForo_FrontController->run() in [removed]/forum/index.php at line 13
I don't see where it is going wrong. Could anyone enlighten me?
 
 
		 
 
		 
 
		