From 53ac336111ac92ece89252a97d27c1318cb6a4e0 Mon Sep 17 00:00:00 2001 From: teromene Date: Thu, 5 Nov 2015 13:28:32 +0000 Subject: [PATCH] =?UTF-8?q?Am=C3=A9lioration=20de=20la=20documentation=20s?= =?UTF-8?q?ur=20la=20cr=C3=A9ation=20de=20bridges.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: teromene --- CREATE_BRIDGE.md | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/CREATE_BRIDGE.md b/CREATE_BRIDGE.md index 215ae282..50333036 100644 --- a/CREATE_BRIDGE.md +++ b/CREATE_BRIDGE.md @@ -20,4 +20,73 @@ The RSS elements are stored in the class variable `items[]`. Every RSS element is an instance of the `Item` class. +##The `loadMetadatas` function +This function is the one used by rss-bridge core to determine the name, maintainer name, website, last updated date... of the bridge, and the user parameters. + +### Basic metadatas. + +The basic metadatas are the following : + +```PHP +$this->maintainer +$this->name +$this->uri +$this->description +$this->update +``` + +The default values are the following : + +```PHP +$this->name = "Unnamed bridge"; +$this->uri = ""; +$this->description = 'No description provided'; +$this->maintainer = 'No maintainer'; +``` + +### Parameters + +Parameters use a JSON-like format, which is parsed and transformed to HTML `
` by rss-bridge. + +These datas goes into the `$this->parameters` array, which is not mandatory if your bridge doesn't take any parameter. + +Every possible usage of a bridge is an array element. + +The array can be a key-based array, but it is not necessary. The following syntaxes are hereby correct : + +```PHP +$this->parameters[] = ... +$this->parameters['First usage of my bridge'] = ... +``` + +### Format specifications + +Every `$this->parameters` element is a JSON array (`[ ... ]`) containing every input. + +It needs the following elements to be setted : +* name, the input name as displayed to the user +* identifier, which will be the key in the `$param` array for the corresponding data. + +Hence, the most basic parameter definition is the following: + +```PHP + $this->parameters = + '[ + { + "name" : "Username", + "identifier" : "u" + + } + ]'; +``` + +####Optional parameters + +Here is a list of optional parameters for the input : + +Parameter Name | Parameter values | Description +---------------|------------------|------------ +type|text, number, list, checkbox| Type of the input, default is text +required| true | Set this if you want your attribute to be required +values| [ {"name" : option1Name, "value" : "option1Value"}, ...] | Values list, required with the 'list' type