dolibarr 21.0.0-alpha
|
Class for handling Diaspora API interactions. More...
Public Member Functions | |
fetch ($urlAPI, $maxNb=5, $cacheDelay=60, $cacheDir='', $authParams=[]) | |
Fetch Social Network API to retrieve posts. | |
normalizeData ($postData) | |
Normalize data of retrieved posts. | |
getPosts () | |
Get the list of retrieved posts. | |
Private Member Functions | |
isCookieValid () | |
Check if the provided cookie in params is valid. | |
getCookieFromParams () | |
Get the cookie value from params, regardless of the exact key name. | |
formatDate ($dateString) | |
Format date for normalize date. | |
Class for handling Diaspora API interactions.
Definition at line 30 of file diasporahandler.class.php.
DiasporaHandler::fetch | ( | $urlAPI, | |
$maxNb = 5, | |||
$cacheDelay = 60, | |||
$cacheDir = '', | |||
$authParams = [] ) |
Fetch Social Network API to retrieve posts.
string | $urlAPI | URL of the Diaspora API. |
int | $maxNb | Maximum number of posts to retrieve (default is 5). |
int | $cacheDelay | Number of seconds to use cached data (0 to disable caching). |
string | $cacheDir | Directory to store cached data. |
array<string,string> | $authParams Authentication parameters including login URL, username, and password. |
Definition at line 80 of file diasporahandler.class.php.
References dol_filemtime(), dol_hash(), dol_is_file(), dol_mkdir(), dol_now(), getCookieFromParams(), getURLContent(), isCookieValid(), and normalizeData().
|
private |
Format date for normalize date.
string | $dateString | Date in string format. |
Definition at line 174 of file diasporahandler.class.php.
References dol_print_date().
Referenced by normalizeData().
|
private |
Get the cookie value from params, regardless of the exact key name.
Definition at line 60 of file diasporahandler.class.php.
Referenced by fetch(), and isCookieValid().
DiasporaHandler::getPosts | ( | ) |
Get the list of retrieved posts.
Definition at line 185 of file diasporahandler.class.php.
|
private |
Check if the provided cookie in params is valid.
Definition at line 51 of file diasporahandler.class.php.
References getCookieFromParams().
Referenced by fetch().
DiasporaHandler::normalizeData | ( | $postData | ) |
Normalize data of retrieved posts.
array<string,mixed> | $postData Data of a single post. |
Definition at line 153 of file diasporahandler.class.php.
References formatDate().
Referenced by fetch().