Begin RHPZ Server.

This commit is contained in:
2026-01-29 18:43:58 +01:00
commit b49424b6ee
25 changed files with 1772 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
<?php
namespace RomhackPlazaFS\Endpoints;
use RomhackPlazaFS\Library\Data;
use RomhackPlazaFS\RomhackPlazaFS;
defined( 'ROMHACKPLAZA_FS' ) || exit;
class Editorfilelist extends Abstract_Endpoint {
private int $post_id;
private string $custom_post_type;
protected function private_endpoint(): bool
{
return false;
}
protected function require_token(): bool
{
return false;
}
protected function get_post_params(): void {
$this->post_id = $this->swiffer_post( "post_id", "int" );
if( $this->post_id < 1 )
RomhackPlazaFS::invalid_parameter_stop( "post_id", "POST" );
$this->custom_post_type = $this->swiffer_post( "post_type", "string" );
if( $this->custom_post_type === "" )
RomhackPlazaFS::invalid_parameter_stop( "post_type", "POST" );
}
protected function process(): void {
$data = Data::setup(
$this->custom_post_type,
$this->post_id
);
$private = Data::setup(
$this->custom_post_type,
$this->post_id,
flags: Data::F_PRIVATE_FILE
);
$archived = Data::setup(
$this->custom_post_type,
$this->post_id,
flags: Data::F_ARCHIVED_FILE
);
$response = [];
$response['files'] = $data->list_files( $this->custom_post_type, $this->post_id );
$response['private'] = $private->list_files( $this->custom_post_type, $this->post_id );
$response['archived'] = $archived->list_files( $this->custom_post_type, $this->post_id );
RomhackPlazaFS::success_response( $response );
}
}