25require_once DOL_DOCUMENT_ROOT.
'/core/class/mastodonhandler.class.php';
56 private $lastFetchDate;
66 $this->platform = $platform;
77 $handlerClass =
dol_ucfirst($this->platform).
'Handler';
78 if (class_exists($handlerClass)) {
79 $this->handler =
new $handlerClass($authParams);
81 $this->error =
"Handler for $this->platform not found.";
95 public function fetchPosts($urlAPI, $maxNb = 5, $cacheDelay = 60, $cacheDir =
'', $authParams = [])
97 if (!$this->handler) {
102 $result = $this->handler->fetch($urlAPI, $maxNb, $cacheDelay, $cacheDir, $authParams);
104 if (!empty($this->handler->error)) {
105 $this->error = $this->handler->error;
118 return $this->handler ? $this->handler->getPosts() : [];
128 return $this->lastFetchDate;
Class to manage Social network posts.
initializeHandler($authParams)
Initialize the social network needed.
getLastFetchDate()
Get the last fetch date.
fetchPosts($urlAPI, $maxNb=5, $cacheDelay=60, $cacheDir='', $authParams=[])
Fetch Social Network API to retrieve posts.
__construct($platform, $authParams=[])
Constructor.
getPosts()
Get the list of retrieved posts.
dol_ucfirst($string, $encoding="UTF-8")
Convert first character of the first word of a string to upper.