mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 23:55:19 +00:00
php warning
This commit is contained in:
parent
4c271a38cc
commit
94c1c89396
2 changed files with 8 additions and 6 deletions
|
@ -36,7 +36,9 @@ class ActivityStreams {
|
|||
/**
|
||||
* @brief Constructor for ActivityStreams.
|
||||
*
|
||||
* Takes a JSON string as parameter, decodes it and sets up this object.
|
||||
* Takes a JSON string or previously decode activity array as parameter,
|
||||
* decodes it and sets up this object/activity, fetching any required attributes
|
||||
* which were only referenced by @id/URI.
|
||||
*
|
||||
* @param string $string
|
||||
*/
|
||||
|
@ -47,6 +49,7 @@ class ActivityStreams {
|
|||
|
||||
if (is_array($string)) {
|
||||
$this->data = $string;
|
||||
$this->raw = json_encode($string,JSON_UNESCAPED_SLASHES);
|
||||
}
|
||||
else {
|
||||
$this->data = json_decode($string, true);
|
||||
|
|
|
@ -2281,20 +2281,20 @@ function jindent($json) {
|
|||
$prevChar = '';
|
||||
$outOfQuotes = true;
|
||||
|
||||
for ($i=0; $i<=$strLen; $i++) {
|
||||
for ($i = 0; $i <= $strLen; $i++) {
|
||||
// Grab the next character in the string.
|
||||
$char = substr($json, $i, 1);
|
||||
|
||||
// Are we inside a quoted string?
|
||||
if ($char == '"' && $prevChar != '\\') {
|
||||
$outOfQuotes = !$outOfQuotes;
|
||||
|
||||
}
|
||||
// If this character is the end of an element,
|
||||
// output a new line and indent the next line.
|
||||
} else if(($char == '}' || $char == ']') && $outOfQuotes) {
|
||||
elseif(($char == '}' || $char == ']') && $outOfQuotes) {
|
||||
$result .= $newLine;
|
||||
$pos --;
|
||||
for ($j=0; $j<$pos; $j++) {
|
||||
for ($j = 0; $j < $pos; $j++) {
|
||||
$result .= $indentStr;
|
||||
}
|
||||
}
|
||||
|
@ -2314,7 +2314,6 @@ function jindent($json) {
|
|||
$result .= $indentStr;
|
||||
}
|
||||
}
|
||||
|
||||
$prevChar = $char;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue