-
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) : boolA 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) : boolA 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) : stringA 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) : boolA 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:
booleanSets the permission for the admin user if he can create content.
- Type:
stringSets 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:
stringSets 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.
$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