Skip to:
Content
Pages
Categories
Search
Top
Bottom

Plugin suggestions

  • I haven’t found such topic, and I think it might be useful (if no, please throw me into oblivion heh). Do you need some additional functionality but you can’t find a plugin and you can’t code? Post ideas here, maybe someone will “code your idea”.

Viewing 20 replies - 1 through 20 (of 20 total)
  • Syntax highlighter. There’s Geshi and Google plugins available for WordPress.

    _ck_ told me how to port them over but I’ve been too busy to do so yet (and it’s not a pressing issue atm. But it will be in the future…)


    Olaf Lederer
    Participant

    @finalwebsites

    A syntax highlighter in wordpress/bbpress is always a hard to do.

    Geshi and tinyMCE = forget it

    I have finally a parser in WP but need to work in code view only.

    finalwebs: _ck_ dismissed geshi too… let me know when you get yours going.


    Olaf Lederer
    Participant

    @finalwebsites

    I’m sorry Vadi,

    I thought a long time about what the best solution for posting code tutorials.

    Actually it’s better to use drupal for this kind of content :(


    _ck_
    Participant

    @_ck_

    WP-Syntax should take all of 10 minutes to port to bbPress:

    http://bbshowcase.org/forums/topic/syntax-highlighter-plugin

    I have a “Syntax-Lite” plugin in development that is less than 1k and uses PHP’s built-in (high speed) highlighter but only works with PHP code of course. It also won’t be available for quite awhile as I don’t have time for bbPress projects these days.

    Been there, tried that – it’s definitely more than 10 minutes :P


    Detective
    Member

    @detective

    I would like to code a plugin to prevent double posting in a certain period of time. For example, i’m adding this reply to this topic, and in 5 minutes i could add another. This plugin would take the second reply and append it to the first one, instead of making a new post (if no one else replied in those 5 minutes).

    It should be straightforward to do, but i don’t have the time :'(


    Sam Bauers
    Participant

    @sambauers

    @Detective

    Why not just edit the previous post? 5 minutes is within the default editing time limit.


    Detective
    Member

    @detective

    @sam:

    That’s what i say to my users, but some of them just don’t get it … for them it’s much easier to just add text into the Reply form than click “edit”.

    Another plugin i need (probably will implement this in two or three weeks) is “Private Discussions”, a plugin to replace Private Messaging. Instead of private messages, two users can have a private discussion. Hopefully, the plugin will need only a few template tweaks and no additional files in the bbPress root folder.

    It should work in a similar way to Vanilla’s Whispers, but without whispers in a public discussion.


    Olaf Lederer
    Participant

    @finalwebsites

    @_ck_

    I worked on the wp-syntax plugin but it doesn’t parse the code :(

    do you have an idea what’s missing?

    function allow_syntax_tag($tags) {
    $tags['pre'] = array('lang' => array(), 'line' => array(), 'escaped' => array(), 'style' => array(), 'width' => array());
    return $tags;
    }
    add_filter('bb_allowed_tags', 'allow_syntax_tag');

    include_once("geshi/geshi.php");

    if (!defined("BB_PLUGIN_URL")) define("BB_PLUGIN_URL", bb_get_uri() . "/my-plugins");

    function wp_syntax_head()
    {
    $css_url = BB_PLUGIN_URL . "wp-syntax/wp-syntax.css";
    echo "n".'<link rel="stylesheet" href="' . $css_url . '" type="text/css" media="screen" />'."n";
    }

    function wp_syntax_code_trim($code)
    {
    // special ltrim b/c leading whitespace matters on 1st line of content
    $code = preg_replace("/^s*n/siU", "", $code);
    $code = rtrim($code);
    return $code;
    }

    function wp_syntax_substitute(&$match)
    {
    global $wp_syntax_token, $wp_syntax_matches;

    $i = count($wp_syntax_matches);
    $wp_syntax_matches[$i] = $match;

    return "nn<p>" . $wp_syntax_token . sprintf("%03d", $i) . "</p>nn";
    }

    function wp_syntax_line_numbers($code, $start)
    {
    $line_count = count(explode("n", $code));
    $output = "<pre>";
    for ($i = 0; $i < $line_count; $i++)
    {
    $output .= ($start + $i) . "n";
    }
    $output .= "</pre>";
    return $output;
    }

    function wp_syntax_highlight($match)
    {
    global $wp_syntax_matches;

    $i = intval($match[1]);
    $match = $wp_syntax_matches[$i];

    $language = strtolower(trim($match[1]));
    $line = trim($match[2]);
    $escaped = trim($match[3]);
    $code = wp_syntax_code_trim($match[4]);
    if ($escaped == "true") $code = htmlspecialchars_decode($code);
    //$code = clean_pre($code);// new
    $geshi = new GeSHi($code, $language);
    $geshi->enable_keyword_links(false);
    do_action_ref_array('wp_syntax_init_geshi', array(&$geshi));

    $output = "n<div class="wp_syntax">";

    if ($line)
    {
    $output .= "<table><tr><td class="line_numbers">";
    $output .= wp_syntax_line_numbers($code, $line);
    $output .= "</td><td class="code">";
    $output .= $geshi->parse_code();
    $output .= "</td></tr></table>";
    }
    else
    {
    $output .= "<div class="code">";
    $output .= $geshi->parse_code();
    $output .= "</div>";
    }

    $output .= "</div>n";

    return $output;
    }

    function wp_syntax_before_filter($content)
    {
    $content = preg_replace_callback(
    "/s*<pre(?:lang=["']([w-]+)["']|line=["'](d*)["']|escaped=["'](true|false)?["']|s)+>(.*)</pre>s*/siU",
    "wp_syntax_substitute",
    $content
    );
    return $content;
    }

    function wp_syntax_after_filter($content)
    {
    global $wp_syntax_token;

    $content = preg_replace_callback(
    "/<p>s*".$wp_syntax_token."(d{3})s*</p>/si",
    "wp_syntax_highlight",
    $content
    );

    return $content;
    }

    $wp_syntax_token = md5(uniqid(rand()));

    // Add styling
    add_action('bb_head', 'wp_syntax_head');

    // We want to run before other filters; hence, a priority of 0 was chosen.
    // The lower the number, the higher the priority. 10 is the default and
    // several formatting filters run at or around 6.
    add_filter('post_text', 'wp_syntax_before_filter', 0);

    // We want to run after other filters; hence, a priority of 99.
    add_filter('post_text', 'wp_syntax_after_filter', 99);


    Olaf Lederer
    Participant

    @finalwebsites

    the problem are the priorities, if I use this filter:

    add_filter(‘post_text’, ‘wp_syntax_before_filter’, 0);

    there is no geshi parsing.

    I get the best result without the priorities, but than I have problems with chars like <> and not allowed tags etc.


    Olaf Lederer
    Participant

    @finalwebsites

    I get it working!

    I added those two replace function before the geshi object is created:

    $code = str_replace("& lt;", "<", $code);

    $code = str_replace("& gt;", ">", $code);

    and I use the default priority for the filters. Are the replacements a problem?

    auto link keywords to their perspective pages.

    with a backend where u can decide which keywords will link to which page. and if someone mentions those words in a post, it will be linked to those pages. like wikipedia a bit.


    Olaf Lederer
    Participant

    @finalwebsites

    @chandersbs, this topic is about geshi syntax highlighting ;)

    @Olaf: It’s about plugin suggestions, check the title. It’s just gotten off-topic.

    @kawauso That’s what I thought


    Olaf Lederer
    Participant

    @finalwebsites

    lol I guess I read the opening post only 11 month ago :)

    edit: btw I will publish the geshi plugin later on my website ;)

    I would like to code a plugin to prevent double posting in a certain period of time. For example, i’m adding this reply to this topic, and in 5 minutes i could add another. This plugin would take the second reply and append it to the first one, instead of making a new post (if no one else replied in those 5 minutes).

    I’d love this plugin very much as well, I’ve seen this in action in vBulletin. It also prevents users for “artificially” increasing their post count.

    How about an updated smilies that works in the new bbpress, maybe incorporate the barfing icon that you can have in skype


    Olaf Lederer
    Participant

    @finalwebsites

    I’m using the smiley plugin from here in my current install 1.02

Viewing 20 replies - 1 through 20 (of 20 total)
  • You must be logged in to reply to this topic.
Skip to toolbar