-
Notifications
You must be signed in to change notification settings - Fork 1
reference:Plugin API
This function gets implemented with Pb2.4Bfx0
(Pb2.4Bfx0)
A content type declares how something get stored and displayed in USOC.
It exists out of a database and a file that declares how the content should be handled. This file should be included in the file plugins/plugins.php
and the file itsself should be located in the plugins
folder. In a manual the plugin should tell the user, how to create the database table needed for a plugin.
To add a plugin you must add a key with a other array to the $U->contentHandlers[]
array.
The name is the name of the plugin.
- Type:
string
Name of the database.
- Type:
string
Name of the plugin shown for the user. In the best case it's a translated string. (It should match to "Create/Upload new ..."(for example "Create/Upload new blog page")
- Type:
string
Name of the author of the plugin
- Type:
string
URL to the info of the plugin
- Type:
string
The URL handler for the content type. For example /blog/
.
- Type:
function
- Returns:
boolean
function (int $Id , array $data) : bool
A function that get executed if a new content page get created. Should return false
if the insertion process should get aborted.
The Id of the created page
PageData array.
See: reference:PageData
- Type:
function
- Returns:
boolean
function (int $Id) : bool
A function that get executed if a content page get deleted. Should return false
if deleting isn't allowed.
The Id the created page that should be deleted.
- Type:
function
- Returns:
string
function (string $code , array $data) : string
A function that get executed if content page get shown to the user. Returns the HTML code that should be displayed.
The code of the page that should be shown.
PageData array.
See: reference:PageData
- Type:
function
- Returns:
boolean
function (int $Id , array $data) : bool
A function that get executed if content page get edited. Should return false
if the the edit process should get aborted.
The Id of the page that should be edited.
PageData array.
See: reference:PageData
- Type:
boolean
Sets the permission for the admin user if he can create content.
- Type:
string
Sets how creating a new content page in admin looks like. Two options are available:
- "Text": Open's text editor
- File path: Path to a file that gets included.
- Type:
string
Sets how creating a new content page in admin looks like. Two options are available:
- "Text": Open's text editor
- File path: Path to a file that gets included.
- Type:
boolean
- Optional
- Default:
True
If set toFalse
the code don't get proceed throughhtmlspecialchars()
- Type:
int
Version of the Plugin API. Current version: 1
$this->contentHandlers["Test"] = ["Name" => "Test", "URL" => "/test/", "AddHandler" => function ($Id, $data){
if($data["Name"] == "Test"){
return False;
}
}, "DeleteHandler" => function ($Id){
if($Id==0){
return False;
}
}, "ShowHandler" => function ($Code, $data){
return $code;
}, "EditHandler" => function ($Id, $data){
return true;
}, "CreateNewContent" => True, "ContentCreateHandler" => "../plugins/Test/new.php", "ContentEditHandler" => "../plugins/Test/edit.php"];
Manuals
- manual:Download-and-install-USOC
- manual:How to install USOC manually
- manual:plugins
- manual:Set-up-oAuth-with-google
Github Manuals
Reference Index