Page 1 of 1

CodeBox Pluss (Syntax Highlighter), Lines Problem.

Posted: Fri Feb 10, 2017 4:47 pm
by Raheem
Hello, I installed THIS extension in my Forum and it's working but there is strange problem i don't know how to fix as i don't know about PHP.

Problem: When i post code without empty lines it add empty line and if i added empty line it add 2 and so in. It increase 1 empty line. Exmaple when i post this code:

Code: Select all

#include <amxmodx>

new iITimeLeft, iIMinutes, iISeconds
new ifTimeLeft, ifMinutes, ifSeconds

public plugin_init()
{
	register_plugin("Time Left", "1.0", "Raheem")
	register_logevent("New_Round", 2, "1=Round_Start")
	
	set_task(1.0, "Check_RoundTimeleft", _, _, _, "b")
}

public New_Round()
{
	iITimeLeft = get_timeleft()
	iIMinutes = iITimeLeft / 60
	iISeconds = iITimeLeft % 60
} 
It appears as in this photo:

Image

It have no sequence seems it's insert empety lines everywhere, Any help or suggestion? Or can anyone make another extention for phpBB 3.2.0 this really important. Thanks in advance.

OK just to fix the line double just open event/main_listener.php

Then find this event: message_parser_event() and then delete it all and add this one:

Code: Select all

/*
    * Event: core.modify_format_display_text_after (message_parser.php)
    * Use: $this->codebox_template()
    * Generate text for preview
    */
    public function message_parser_event($event)
    {
        if (isset($event['text']))
        {
            $text = $event['text'];
            $post_id = 0;
            $part = 0;
            $text = preg_replace_callback('#<div class="codebox" title="' . preg_quote($this->user->lang['CODEBOX_PLUS_TITLE']) . '" data-language="(.*?)" data-filename="(.*?)"><p>.*?</p><code>(.*?)</code></div>#msi',
                        function ($arg) use ($post_id, &$part)
                        {
                            // Before : 
                            //return $this->codebox_template(preg_replace('#\<br\\s*/?\>#msi', "\n", $arg[3]), $arg[1], $arg[2], $post_id, ++$part);
                            // After : 
                            return $this->codebox_template(preg_replace('#\<br\\s*/?\>#msi', "", $arg[3]), $arg[1], $arg[2], $post_id, ++$part);
                        },
                        $text);
            //$text = preg_replace('#<div class="codebox" title="' . preg_quote($this->user->lang['CODEBOX_PLUS_TITLE']) . '" data-language="(.*?)" data-filename="(.*?)"><p>.*?</p><code>(.*?)</code></div>#msie', "\$this->codebox_template(preg_replace('#\<br\\s*/?\>#msi', '\n', '\$3'), '\$1', '\$2', \$post_id, ++\$part)", $text);
            $event['text'] = $text;
        }
  }

Re: CodeBox Pluss (Syntax Highlighter), Lines Problem.

Posted: Mon Feb 13, 2017 8:18 am
by AmigoJack
Ugh, I would ask where I downloaded the software from. And this comment looks promising.

Re: CodeBox Pluss (Syntax Highlighter), Lines Problem.

Posted: Mon Feb 13, 2017 11:12 am
by Raheem
AmigoJack wrote:
Mon Feb 13, 2017 8:18 am
Ugh, I would ask where I downloaded the software from. And this comment looks promising.
Oh my bad i don't see this. It's working now thanks but can you tell me how to add scroll bar like in the default one?

Strange, code tag in this forum updated? I see now it's have an style it was before just green. So now it's:

Code: Select all

#include <zombie_escape>

// Fowards
enum _:TOTAL_FORWARDS
{
	FORWARD_NONE = 0,
	FORWARD_ROUNDEND,
	FORWARD_HUMANIZED,
	FORWARD_INFECTED,
	FORWARD_ZOMBIE_APPEAR,
	FORWARD_ZOMBIE_RELEASE,
	FORWARD_GAME_STARTED
}
How they do this :P? I think this will be better for me than this extension as i just use one language style only.

Re: CodeBox Pluss (Syntax Highlighter), Lines Problem.

Posted: Mon Feb 13, 2017 11:29 am
by JimA
This isn't really an extension request, so therefore doesn't really fit in this forum. I'd recommend you create a new issue on Github (where you downloaded it) to let the author have a look. :)

Re: CodeBox Pluss (Syntax Highlighter), Lines Problem.

Posted: Mon Feb 13, 2017 11:48 am
by Raheem
JimA wrote:
Mon Feb 13, 2017 11:29 am
This isn't really an extension request, so therefore doesn't really fit in this forum. I'd recommend you create a new issue on Github (where you downloaded it) to let the author have a look. :)
Yeah so please move this topic to the right section. Also the problem already solved thanks for AmigoJack.
Issue is already opened but the author in-active and the solution also is discussed on github i just miss to read it. Now i can post with style :D.

Re: CodeBox Pluss (Syntax Highlighter), Lines Problem.

Posted: Mon Feb 13, 2017 11:51 am
by JimA
Raheem wrote:
Mon Feb 13, 2017 11:48 am
Yeah so please move this topic to the right section.
That was kind of my point, we don't have a section for extensions not released on this site. ;)
But I'm happy that you've got your problems resolved regardless.

Re: CodeBox Pluss (Syntax Highlighter), Lines Problem.

Posted: Mon Feb 13, 2017 11:56 am
by Raheem
Hmm, Ok you can move it to the general discussion section better :)

Re: CodeBox Pluss (Syntax Highlighter), Lines Problem.

Posted: Sat May 13, 2017 7:06 pm
by aurquiel
Could some one make it work? In my board works but with issues