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
Whether to use it or not, is your decision entirely. The question is whether you want PluginLibrary to do things for you, or do them yourself.

Settings are simple, right? But does your code set disporder correctly, does it prevent duplicates/leftovers, does it handle updates without losing data at all? Do you have a language file for setting translation? Do you want to do this yourself or do you want a function that does it for you?

That's kinda what PluginLibrary is all about. It makes settings easy to create and maintain; it creates templates in a way that allows users to edit and revert them; stuff that's useful for many plugins and which isn't really that simple to implement yourself and not usually covered in tutorials.

I did ask for plugin api functionality to be added to core, back in 2008, and was told to wait for MyBB 2.

There are advantages to it being a third party library, as long as the developer is active anyway: If there is a bug report today, I can release a bugfix tomorrow. No need to wait months for the next MyBB version, and no need to tell admins to update their entire boards instead of just a plugin.
I mean no offense by it.

If it was there was an overall option by the majority of plugin developers to use and support it then I absolutely would include it without question.

It seems like a good idea to adopt it as a standard, but at this stage I guess we aren't really there yet.

Cheers
Dan
Hey frostschutz,

I forked your repository on github and added a few methods for working with stylesheets (stylesheet() and stylesheet_delete()). You can view the commit here (check the comments too - seems like a lot of changes because my editor converted indentation to tabs to the spaces you seem to use). I've opened a new pull request, hope you don't mind. I think it's a pretty useful thing to have. I personally need to add a stylesheet for one of my plugins and am already requiring PluginLibrary.

Cheers.
Thanks, I'll have a look at it over the weekend.

I'll add this to the next version of PluginLibrary, but I want to adapt it a little first. I'll probably add a pluginname/prefix parameter as in settings()/templates() to help avoid conflicts between plugins; so plugin styles will be pluginname_foo.css pluginname_bar.css. Since attachto has to be in a very specific format, I'll allow it to be passed as array instead of string. CSS could probably be passed as array too, as MyBB already does something similar for the CSS editor. I'll also have to double check if that css.php crutch is really necessary...
Ok, thanks a lot Smile Regarding the CSS.php thing, it's necessary if file permissions on the cache folder are incorrect I believe.
Seems like a good addition. I can certainly use style sheet functionality
PluginLibrary 9 adds stylesheet()/stylesheet_delete()/stylesheet_deactivate().

Stylesheets are a lot more hassle than I anticipated. They need to be created/updated on activate(), deleted on uninstall(), but also deactivated on deactivate() as otherwise the board keeps loading styles for a deactivated plugin. At the same time users should be able to edit them using inheritance the same way the original MyBB stylesheets do. I can't think of a good way to update edited stylesheets [no way to distinguish between a property you added and a property the user removed], so only the master stylesheet is updated and reverting/reediting is left to the user. Unfortunately MyBB does not offer a nice diff here like it does for templates...

euantor, this isn't quite what you commited, but I hope it is what you wanted... let me know how it works out for you
PluginLibrary 10 fixes a bug in the stylesheet functions (image URLs weren't "fixed" the same way MyBB does).
Thanks for this release frostschutz. The new stylesheet method really is useful.
my boards had these error

how to fix ??? Huh
at headear ????

Hello PluginLibrary!

This is a sample PluginLibrary Plugin (which can be disabled!) that displays this message on all pages.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16