YesNoOk
avatar

Re: Syntaxhighlighter test (Read 2448 times)

Started by Nightwish, September 19, 2011, 03:47:31

0 Members and 1 Guest are viewing this.
Share this topic:
New #1
Re: Syntaxhighlighter test |
September 19, 2011, 03:47:31
Test syntax highlighter

Syntax highlighting is completely client-sided, implemented in JavaScript using Google's code prettify

No expensive PHP parsing means less server load. Prettify supports many different languages and is extend- and customizable via style sheets and language plugins. It is integrated into the default theme and supported by the [code=lang] and [php] tags.

Code: (js)
function getAStream(el)
{
var _el = el.children('a:first');
if(_el.attr('data-board') == 'all')
sendRequest('action=astream;sa=get;all', _el);
else
sendRequest('action=astream;sa=get;b=' + parseInt(_el.attr('data-board')), _el);
}
Code: (php)
function aStreamDispatch()
{
    global $context, $sourcedir;

    $xml = isset($_REQUEST['xml']) ? true : false;
    if(!in_array('as', $context['admin_features'])) {
        if(!$xml)
            redirectexit();
        else
            obExit(false);
    }

    require_once($sourcedir . '/Subs-Activities.php');
    $sub_actions = array(
        'get' => array('function' => 'aStreamGetStream'),
        'add' => array('function' => 'aStreamAdd'),
        'notifications' => array('function' => 'aStreamGetNotifications'),
        'markread' => array('function' => 'aStreamMarkNotificationRead')
    );
    if (!isset($_REQUEST['sa'], $sub_actions[$_REQUEST['sa']]))
        fatal_lang_error('no_access', false);

    $sub_actions[$_REQUEST['sa']]['function']();
}
__
Every program has at least one bug and can be shortened by at least one instruction -- from which, by induction, one can deduce that every program can be reduced to a single instruction that doesn't work.
My SMF-based forum fork
2 Like It 
Last Edit: July 27, 2012, 02:07:34 by Nightwish
#2
Re: Re: Syntaxhighlighter test |
July 26, 2012, 18:17:20
Is this information still up to date? Or have you changed to prettify.js?

on a related note, drafts.js is still referenced from Post.php and Display.php, but you removed it in an earlier commit.
Last Edit: July 26, 2012, 18:24:41 by Valodim
#3
Re: Re: Syntaxhighlighter test |
July 26, 2012, 22:28:41
Is this information still up to date? Or have you changed to prettify.js?
It is prettify now
Quote
on a related note, drafts.js is still referenced from Post.php and Display.php, but you removed it in an earlier commit.
Drafts feature will most likely be a plugin, right now it's still a core feature, so parts of the code are still left in the core.
__
Every program has at least one bug and can be shortened by at least one instruction -- from which, by induction, one can deduce that every program can be reduced to a single instruction that doesn't work.
My SMF-based forum fork