MyBB.de Forum

Normale Version: PluginLibrary
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Seiten: 1 2 3 4
Eine neue Erweiterung wurde veröffentlicht: PluginLibrary

Zitat:PluginLibrary is not a stand-alone plugin, but rather a library of useful functions that can be used by plugins and plugin developers. For example, it can help you manage settings of your plugin, or apply edits to core files. The list of PluginLibrary's features is expected to grow over time and contributions are welcome.

PluginLibrary is Open Source Software, licensed under the GNU Lesser General Public License, Version 3. This is the same license as MyBB itself uses, so if you can use MyBB, you should also be able to use PluginLibrary.

PluginLibrary is Copyright © 2011 Andreas Klauer ([email protected])

Function overview:

  • settings()
    This function creates a setting group and a list of settings. If the setting group already exists, the settings inside this group will be updated to their new names and descriptions, while keeping their custom values intact. Settings that no longer exist will be removed. Optionally, it also generates a language file for your settings.
  • settings_delete()
    This function deletes one (or more) setting groups and settings.
  • templates()
    Create a template group and list of templates. If the group already exists, the templates will be added/updated/removed depending on whether a template is new/changed/no longer in use. User edited versions of updated templates will show up in MyBB's "Find Updated Templates" feature.
  • templates_delete()
    Deletes one (or more) template groups and their templates.
  • stylesheet()
    This function creates/updates/activates a stylesheet in the MyBB Master Style. It will be inherited by all themes, enabling the user to edit and revert like the official stylesheets.
  • stylesheet_delete()
    Delete one or more stylesheets.
  • stylesheet_deactivate()
    Deactivate one or more stylesheet without losing user edits.
  • cache_read()
    This function reads an on-demand cache and returns its value (if present). Note that on-demand cache is allowed to vanish any time.
  • cache_update()
    This function creates or updates an on-demand cache with contents. Unlike MyBB's built-in $cache, it does not use the database nor does it load the cache automatically. Instead it uses a more specialized cache handler (by default: disk) directly, and you have to load the cache on demand using $PL->cache_read().
  • cache_delete()
    This function safely deletes one (or more) caches.
  • edit_core()
    This function makes, updates, and undoes simple, line based changes to PHP/JS/CSS files. Using search patterns, it locates blocks of one or more lines of code, and inserts new code before or after them, or replaces them.
  • is_member()
    This function checks if a user is member of one or more groups. Useful if your plugin has a setting to include/exclude one or more groups.
  • url_append()
    Append one or more query parameters to an URL that may or may not have an existing ?query. The parameters will be encoded properly.
  • xml_export()
    Export arbitrary data as XML.
  • xml_import()
    Import previously exported data from XML.

The full developer documentation and a sample plugin is included in the package.

Support: http://community.mybb.com/thread-87399.html
Ich will ja nicht unhöflich sein, könnte mir aber jemand das Teil auf rapidshare oder sonstwo hochladen?
MYBB.com ist bei mir down^^
Du findest alle meine Plugins auch hier https://github.com/frostschutz

Passendes Projekt auswählen, Download anklicken, da sollte dann eine Liste mit Tags (in der Regel Release-Versionen) drunter erscheinen, anklicken, downloaden.
Ouuh danke! Dann kann ich endlich weiter mein Forum einrichten!
Hallo,
ich schreibe grad meine Plugins (nicht die, die ich hier veröffentlicht habe) um und habe Probleme mit den Templates, die nicht im Cache geladen werden.
Alle Templates, die über meine Plugins lade, würde ich gern an Cache übergeben.

Geht das auch über PluginLibrary, oder muss ich das anders lösen?
Dazu musst du die $templatelist anpassen, z.B. mit dem Hook "global_start".
Danke Stefan, werde das heute Abend mal probieren.

Ist dann die Funktion cache_read() damit hinfällig, oder was kann ich mit dieser Funktion einlesen?
Das ist ein allgemeiner Datencache (wie MyBB's $cache). Mit den Templates hat das erstmal nichts zu tun.

Wenn dein Plugin z.B. eine Anzeige macht die umständlich mit vielen Datenbank-Queries erzeugt werden muss, die sich gleichzeitig aber nur selten / kaum ändert, dann kann es Sinn machen diese Daten zu cachen statt bei jedem Seitenaufruf neu über die Datenbank zu gehen.

MyBB's Cache hat dann den Nachteil daß alle Caches immer geladen werden (zumindest beim Datenbank-Cache) und jedes Aktualisieren eines Caches auch wieder ein Datenbank-Query nach sich zieht.

Die Cache-Funktion in PluginLibrary lädt und schreibt nur bei Bedarf (z.B. in eine Cache-Datei) und umgeht die Datenbank komplett.
Vielen Dank frostschutz, das hilft mir nun nochmal wieder weiter.
Hallo, ich finde einfach nicht heraus, wie ich user ausschließen kann:

if($PL->is_member('3,4,6'))
{
show_secret_menu();
}

Egal, wo ich das Ausrufezeichen setze, es funktioniert einfach nicht!
Oder gibt es dazu eine andere Anweisung?
Seiten: 1 2 3 4