54 $this->userLanguage = $DIC->user()->getLanguage();
56 $responseBody = json_decode($responseBody,
true);
59 $this->contentType = $obj->getContentType();
61 $this->isMixedContentType = $obj->isMixedContentType();
64 if (count($responseBody)) {
65 $this->response = current($responseBody);
66 $this->statements = $this->response[
'statements'];
67 $this->maxCount = $this->response[
'maxcount'];
70 $this->statements = array();
75 $this->cmixUsersByIdent[$cmixUser->getUsrIdent()] = $cmixUser;
91 return (
bool) count($this->statements);
98 foreach ($this->statements as
$index => $statement) {
106 'statement' => json_encode($statement, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
115 return $statement[
'timestamp'];
120 if ($this->isMixedContentType)
122 $ident = str_replace(
'mailto:',
'', $statement[
'actor'][
'mbox']);
124 $ident = $statement[
'actor'][
'account'][
'name'];
129 $ident = $statement[
'actor'][
'account'][
'name'];
133 $ident = str_replace(
'mailto:',
'', $statement[
'actor'][
'mbox']);
135 return $this->cmixUsersByIdent[$ident];
140 return $statement[
'verb'][
'id'];
145 return $statement[
'verb'][
'display'][
'en-US'];
150 $ret = urldecode($statement[
'object'][
'id']);
151 $lang = self::getLanguageEntry($statement[
'object'][
'definition'][
'name'],$this->userLanguage);
152 $langEntry =
$lang[
'languageEntry'];
153 if ($langEntry !=
'')
162 return $statement[
'object'][
'definition'][
'description'][
'en-US'];
173 $defaultLanguageEntry =
'';
174 $defaultLanguageExists =
false;
176 $firstLanguageEntry =
'';
177 $firstLanguageExists =
false;
179 $userLanguageEntry =
'';
180 $userLanguageExists =
false;
184 foreach ($obj as $k => $v)
187 if ($firstLanguage ==
'')
189 $f =
'/^[a-z]+\-?.*/';
190 if (preg_match(
$f,$k))
192 $firstLanguageExists =
true;
194 $firstLanguageEntry = $v;
200 $defaultLanguageExists =
true;
201 $defaultLanguageEntry = $v;
206 if (preg_match($p,$k))
208 $userLanguageExists =
true;
210 $userLanguageEntry = $v;
216 if ($userLanguageExists)
219 $languageEntry = $userLanguageEntry;
221 elseif ($defaultLanguageExists)
224 $languageEntry = $userLanguageEntry;
226 elseif ( $firstLanguageExists)
228 $language = $firstLanguage;
229 $languageEntry = $firstLanguageEntry;
231 return [
'language' => $language,
'languageEntry' => $languageEntry];
static getUsersForObject($objId, $asUsrId=false)
static getLanguageEntry($obj, $userLanguage)
fetchObjectName($statement)
__construct(string $responseBody, $obj)
fetchObjectInfo($statement)
fetchVerbDisplay($statement)