diff --git a/CREATE_BRIDGE.md b/CREATE_BRIDGE.md index 9948050c..748ab3c7 100644 --- a/CREATE_BRIDGE.md +++ b/CREATE_BRIDGE.md @@ -1,53 +1,54 @@ # Howto create a bridge -A bridge is an interface that allows rss-bridge to create a RSS feed from a website. -The bridge is a PHP file, located in the `bridges/` folder. +A bridge is an class that allows rss-bridge to create a RSS feed from a website. +The bridge is a PHP file, located in the [`bridges/`](bridges/) folder. -##Specifications +Read the following chapters an make sure to read the [Guidelines](#guidelines)! -A rss bridge must extend the `BridgeAbstract` class, and implement the following functions : +## Specifications -* The `loadMetadatas` function, described below, -* The `getCacheDuration` function, describing the time during which rss-bridge will output cached values instead of re-generating a RSS feed. -* The `collectData` function, also described below. +A rss bridge must extend the `BridgeAbstract` class and implement the following functions : -##The `collectData` function +* [`loadMetadatas`](#the-loadmetadatas-function) +* [`collectData`](#the-collectdata-function) +* [`getName`](#the-getname-function) +* [`getURI`](#the-geturi-function) +* [`getCacheDuration`](#the-getcacheduration-function) -This function takes as a parameter an array called `$param`, that is automatically filled with values from the user, according to the values setted in `loadMetadatas`. -This function is the place where all the website scrapping and the RSS feed generation process will go. +Find a [template](#template) at the end of this file. -The RSS elements are stored in the class variable `items[]`. +## The `loadMetadatas` function -Every RSS element is an instance of the `Item` class. +This function is used by rss-bridge to determine the name, maintainer name, website, last updated date... of the bridge, and the user parameters. -##The `loadMetadatas` function +### Basic metadatas -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 : +The basic metadatas are : ```PHP -$this->maintainer -$this->name -$this->uri -$this->description -$this->update +$this->maintainer // Name of the maintainer +$this->name // Name of the bridge +$this->uri // URI to the target website of the bridge ("http://....") +$this->description // A brief description of the bridge +$this->update // Date of last change in format "yyyy-mm-dd" +$this->parameters // (optional) Definition of additional parameters ``` -The default values are the following : +Find a description of `$this->parameters` [below](#parameters) + +The default values are : ```PHP +$this->maintainer = 'No maintainer'; $this->name = "Unnamed bridge"; $this->uri = ""; $this->description = 'No description provided'; -$this->maintainer = 'No maintainer'; +$this->parameters = array(); ``` ### Parameters -Parameters use a JSON-like format, which is parsed and transformed to HTML `