Begin RHPZ Server.
This commit is contained in:
62
src/Endpoints/Editorfilelist.php
Normal file
62
src/Endpoints/Editorfilelist.php
Normal 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 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user