X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FSystem.php;h=f94004a880ab10a047935c653432cb887cc25aab;hb=88b3effc180c5477bc8002b9d9ea8f3f628588dd;hp=ec214fea9d26f613e260051903ac09fbbf48d43c;hpb=1f889b6086c5fe81a4ab694a55efa1134f8326b3;p=friendica.git diff --git a/src/Core/System.php b/src/Core/System.php index ec214fea9d..f94004a880 100644 --- a/src/Core/System.php +++ b/src/Core/System.php @@ -1,6 +1,6 @@ setType(Response::TYPE_XML); - DI::apiResponse()->addContent(XML::fromArray(["result" => $result], $xml)); + DI::apiResponse()->addContent(XML::fromArray(['result' => $result])); DI::page()->exit(DI::apiResponse()->generate()); self::exit(); @@ -665,10 +665,11 @@ class System /** * Fetch the system rules + * @param bool $numeric_id If set to "true", the rules are returned with a numeric id as key. * * @return array */ - public static function getRules(): array + public static function getRules(bool $numeric_id = false): array { $rules = []; $id = 0; @@ -681,7 +682,11 @@ class System foreach (explode("\n", trim($msg)) as $line) { $line = trim($line); if ($line) { - $rules[] = ['id' => (string)++$id, 'text' => $line]; + if ($numeric_id) { + $rules[++$id] = $line; + } else { + $rules[] = ['id' => (string)++$id, 'text' => $line]; + } } } }