MyBB Community Forums

Full Version: PluginLibrary 13
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Just wanted to say that I just used PluginLibrary 3 to create a small plugin for use with a theme I'm making and that it really sped things up (especially as I was dealing with the cache).

One thing I would like to propose is some kind of way to check when a cache was last updated. For this plugin, I just added a "lastupdated" timestamp to the cached data, but a method to check it would help (as the timestamp would be applied to the cache automatically). I don't reckon this should be too hard from reading the documentation as you stated the cache was stored in the filesystem, correct?

Anyway, great work once again.
Is this plugin suppose to be Activated/Installed? Just to make sure...
frostschutz you truly make some of the most useful plugins for MyBB that I have ever seen.
(2011-06-07, 07:11 PM)Sama34 Wrote: [ -> ]Is this plugin suppose to be Activated/Installed? Just to make sure...

No, simply upload it to the /inc/plugins/ folder Smile Follow the documentation if you're unsure.
@euantor, thanks, I want to install Patches so I was unsure about the documentation.

I'm not a developer but Patches looks good, so this plugin must be good as well Toungue
Version 4 brings no major changes, just minor improvement and bugfixes.

- cache_delete is more thorough when deleting cache files
- edit_core allows multiline strings to be specified as string array now
- url_append understands anchors # in URLs
- settings would cause SQL errors when given odd input
Version 5 fixes a possible file corruption bug in edit_core() which somehow managed to slip through testing. The bug was introduced in version 4. Edits that remove/replace code without adding any new lines afterward, caused a line of the original file to be missing after revert/reapplying the edit.
Version 6 fixes some minor obscure bugs, and adds a new feature:

PluginLibrary can now manage template groups and templates, the same way it already does for setting groups and settings.

Code from the hello_pl.php Hello PluginLibrary example plugin:
$PL->templates("hellopl", // template prefix, must not contain _
               "Hello Pluginlibrary!", // you can also use "<lang:your_language_variable>" here
               array(
                   "" => "<p>This is the <b>hellopl</b> template...</p>",
                   "example" => "<p>...and this is the <i>hellopl_example</i> template.</p>",
                   "other" => "Another template using {\$hellopl} and {\$hellopl_example}.",
                   )
    );
cool. how does it handle updating existing templates? is it the same as a manual edit?

so the array appends the key to the first parameter with an underscore, and an empty key assumes the name of the first parameter of the function.

(2012-01-19, 08:32 PM)pavemen Wrote: [ -> ]how does it handle updating existing templates?

Let's say you have a plugin that creates these templates: (pseudocode)

templates('a' => 'A', 'b' => 'B', 'c' => 'C')

Then you update your plugin and the templates look like so:

templates('a' => '*A*', 'b' => 'B', 'd' => 'D')

Then PluginLibrary would do the following:

- It would update the template 'a' to say *A* instead of A.
- If the user edited the a template, it will bump the version of the user edited template, so it will show up in "Find Updated Templates". The user edited version of the template itself isn't changed (the user has to do that himself, same way with when MyBB updates templates).
- It would leave the template 'b' alone since there is no change. User edited versions of 'b' won't show up in "Find Updated Templates" either.
- It would delete template 'c' (both master and user edited templates) because this template was removed from the list and thus is not in use by the plugin any more
- It would add the template 'd' since its new.

The update process for settings is pretty much the same - add new settings, update descriptions of existing settings (but keep values in case users changed them), delete no longer used settings.

Quote:so the array appends the key to the first parameter with an underscore, and an empty key assumes the name of the first parameter of the function.

Yes. That is how MyBB classifies templates. Unlike settings, the template table does not have an entry for template group ids, so the group membership is determined using the template name / prefix alone. That is also why template prefixes must not contain underscore _ since it uses explode('_', templatename)[0] as prefix.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16