QuickReferences 1.2

7 Aug 2016 Edited
#1
QuickReferences is a simple plugin which lets you reference to other threads quickly using their identifiers. Thanks to At.js, a dropdown list will be generated everytime your users type an hashtag (#) followed by the threads name they want to search for. The dropdown is attached to textareas and MyBB's default WYSIWYG editor (SCEditor) both in WYSIWYG and Source modes when you post a new thread, new reply, edit a post, perform a quick reply and perform a quick edit (basically, everywhere it is most useful).

CKEditor-based plugins (including Rin Editor) are supported.

Starting from 1.2, Unicode characters are supported.

[Image: WiE0XgP.gif]

Technical implementation


QuickReferences exploits AJAX to query the database for a list of threads containing your search words. It's packed with a stupidly simple caching system which prevents sending too many queries, saving resources. Results are limited to 5 threads per search query and when a query string returns less than 5 threads, it stops querying the database and gets threads from the cache.

On the backend side, hashtags followed by threads identifiers are matched using a regular expression and replaced by a placeholder when singular posts are parsed. In the end, a single query of all collected thread identifiers is performed and existing threads ultimately replace valid placeholders. Non existing threads are not parsed and their corresponding placeholders are restored by the original matched string.

Customization


You can customize links generated by QuickReferences by using the CSS class .quick_reference.

Requirements


QuickReferences requires MyBB 1.8.0+ and PHP 5.4+.

You can follow the plugin's development here: QuickReferences development.

Installation instructions


The installation is as simple as uploading the files maintaining the same folder structure they are compiled to and clicking the button Install & activate within your board's plugin list.

QuickReferences does not add any settings.

QuickReferences adds a CSS file named at.css to every theme of your board. You can customize the dropdown's appearance by editing the stylesheet's CSS rules.

Upgrading instructions from older versions to newer ones


Simply upload the new files, replacing the old ones. You don't need to uninstall the plugin.

Reporting issues


If you encounter an issue, feel free to open a new thread in this forum with detailed instructions on how to reproduce your issue. Suggestions and feature requests are appreciated as well.
Filename Size Downloads
19.31 KB 185
honger, Glaumy, Enes Palit And 2 others like this post
Shade 31 Jul
#41
I don't usually provide support for third party plugins. If you want you can alter that plugin as follows. Find in inc/plugins/MinimalEditor/hooks_frontend.php:

$output $parser->parse_message($mybb->get_input('message'), $parser_options); 
Add after:

$output quickreferences_fill_placeholders($output); 
This should suffice.
Sama34 31 Jul
#42
I see, yes, it should work. Ideally this could be handled from within QuickReferences but I could push a PR for your consideration at a later time.

Thanks.
Shade 31 Jul
#43
I agree that QuickReferences should handle all cases. Problem is, if I put the placeholders filler within the parser itself there will be a spike in resource usage, because in some places (like showthread for example) it is called several times.

I need to have a look at another way to handle it.
Sama34 31 Jul Edited
#44
I was thinking of something around the following lines:
$plugins->add_hook('parse_message_end''quickreferences_parse_message_end');
function 
quickreferences_parse_message_end(&$message)
{
    global 
$mybb$plugins;

    if(
defined('THIS_SCRIPT') && THIS_SCRIPT == 'xmlhttp.php' && $mybb->get_input('action') == 'get_preview')
    {
        
$message quickreferences_fill_placeholders($message);
    }

    
$plugins->remove('parse_message_end''quickreferences_parse_message_end');

Edit: But indeed, this would be to "provide support for third party plugins", which you would like to avoid.
albano 8 Aug
#45
Hello there,

Is there any way to make all references permanent links. For instance, when I upgrade MyBB and I have to disable to QuickRef plug in, all QuickRef links only show the threadID. I would prefer to have an option to make some QuickREf threadID permanent links without the threadID. Hopefully, I'm elaborating my question well.
Shade 8 Aug
#46
No, there is not. QuickReferences is designed to follow through link and title changes, and the only way to do that is to reference to thread identifiers.