[FormatAbstract] Add new page

LogMANOriginal 2016-11-05 19:34:56 +01:00
parent 9f6e95a81b
commit 0ea277ee19

92
FormatAbstract.md Normal file

@ -0,0 +1,92 @@
The `FormatAbstract` class implements the [`FormatInterface`](FormatInterface) interface with basic functional behavior and adds common helper functions for new formats:
* [setCharset](#the-setcharset-function)
* [getCharset](#the-getcharset-function)
* [setContentType](#the-setcontenttype-function)
* [callContentType](#the-callcontenttype-function)
* [getItems](#the-getitems-function)
* [setExtraInfos](#the-setextrainfos-function)
* [getExtraInfos](#the-getextrainfos-function)
* [sanitizeHtml](#the-sanitizehtml-function)
* [array_trim](#the-array_trim-function)
#Functions
#The `setCharset` function
The `setCharset` function receives the character set value as string and returns the object instance.
```PHP
setCharset(string): self
```
#The `getCharset` function
The `getCharset` function returns the character set value.
```PHP
getCharset(): string
```
#The `setContentType` function
The `setContentType` function receives a string defining the content type for the HTML header and must return the object instance.
```PHP
setContentType(string): self
```
#The `callContentType` function
The `callContentType` function applies the content type to the header data and must return the object instance.
```PHP
callContentType(): self
```
#The `getItems` function
The `getItems` function returns the items previously set by the [`setItems`](FormatInterface#the-setitems-function) function. If no items where set previously this function returns an error.
```PHP
getItems(): array
```
#The `setExtraInfos` function
The `setExtraInfos` function receives an array of elements with additional information to generate format outputs and must return the object instance.
```PHP
setExtraInfos(array $infos): self
```
Currently supported information are:
Name | Description
-----|------------
`name` | Defines the name as generated by the bridge
`uri` | Defines the URI of the feed as generated by the bridge
#The `getExtraInfos` function
The `getExtraInfos` function returns the information previously set via the [`setExtraInfos`](#the-setextrainfos-function) function.
```PHP
getExtraInfos(): array
```
#The `sanitizeHtml` function
The `sanitizeHtml` function receives an HTML formatted string and returns the string with disabled `<script>`, `<iframe>` and `<link>` tags.
```PHP
sanitizeHtml(string $html): string
```
#The `array_trim` function
The `array_trim` function receives an array of strings and returns the same array with all elements trimmed (like using the `trim` function on all elements)
```PHP
array_trim(array $elements): array
```