mirror of
https://github.com/friendica/friendica
synced 2025-04-19 07:10:11 +00:00
API: Central way to fetch the system rules
This commit is contained in:
parent
8cb7d4a9bd
commit
b6f7d31036
4 changed files with 33 additions and 18 deletions
|
@ -59,6 +59,6 @@ class Instance extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
System::jsonExit(new InstanceEntity($this->config, $this->baseUrl, $this->database));
|
||||
System::jsonExit(new InstanceEntity($this->config, $this->baseUrl, $this->database, System::getRules()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,21 +38,6 @@ class Rules extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
$rules = [];
|
||||
$id = 0;
|
||||
|
||||
if (DI::config()->get('system', 'tosdisplay')) {
|
||||
$html = BBCode::convert(DI::config()->get('system', 'tostext'), false, BBCode::EXTERNAL);
|
||||
|
||||
$msg = HTML::toPlaintext($html, 0, true);
|
||||
foreach (explode("\n", $msg) as $line) {
|
||||
$line = trim($line);
|
||||
if ($line) {
|
||||
$rules[] = ['id' => (string)++$id, 'text' => $line];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System::jsonExit($rules);
|
||||
System::jsonExit(System::getRules());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue