-
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
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
$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;
}]
Manuals
- manual:Download-and-install-USOC
- manual:How to install USOC manually
- manual:plugins
- manual:Set-up-oAuth-with-google
Github Manuals
Reference Index