| Server IP : 151.101.66.159 / Your IP : 216.73.216.66 Web Server : Flywheel/5.1.0 System : Linux wordpress 6.12.113+ #1 SMP Thu Oct 22 02:38:20 UTC 2026 x86_64 User : root ( ) PHP Version : 7.4.33.18 Disable Function : disk_free_space,diskfreespace,dl,exec,fpassthru,getmypid,getmyuid,highlight_file,link,opcache_compile_file,opcache_get_configuration,opcache_is_script_cached,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifcontinued,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,phpinfo,popen,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,socket_listen,source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wp-content/plugins/pods/src/Pods/REST/V1/Endpoints/ |
Upload File : |
<?php
namespace Pods\REST\V1\Endpoints;
// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
use Pods\REST\Interfaces\Endpoints\DELETE_Interface;
use Pods\REST\Interfaces\Endpoints\READ_Interface;
use Pods\REST\Interfaces\Endpoints\UPDATE_Interface;
use Pods\REST\Interfaces\Swagger\Provider_Interface;
use WP_REST_Request;
class Pod extends Base implements READ_Interface, UPDATE_Interface, DELETE_Interface, Provider_Interface {
/**
* {@inheritdoc}
*
* @since 2.8.0
*/
public $route = '/pods/%1$d';
/**
* {@inheritdoc}
*
* @since 2.8.11
*/
public $rest_route = '/pods/(?P<id>\\d+)';
/**
* {@inheritdoc}
*
* @since 2.8.11
*/
public $rest_doc_route = '/pods/{id}';
/**
* {@inheritdoc}
*
* @since 2.8.0
*/
public $object = 'pod';
/**
* {@inheritdoc}
*
* @since 2.8.0
*/
public function get_documentation() {
$GET_defaults = [
'in' => 'query',
'default' => '',
'type' => 'string',
];
$POST_defaults = [
'in' => 'body',
'default' => '',
'type' => 'string',
];
return [
'get' => [
'summary' => 'Retrieve a specific Pod',
'parameters' => $this->swaggerize_args( $this->READ_args(), $GET_defaults ),
'responses' => [
'200' => [
'description' => 'Returns the requested Pod with its details',
'content' => [
'application/json' => [
'schema' => [
'$ref' => '#/components/schemas/Pod',
],
],
],
],
'400' => [
'description' => 'The request was invalid or cannot be otherwise served',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
],
],
],
],
'401' => [
'description' => 'Unauthorized access - user does not have permission to access this Pod',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
],
],
],
],
'404' => [
'description' => 'The requested Pod was not found',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
],
],
],
],
],
],
'put' => [
'summary' => 'Update a specific Pod',
'parameters' => $this->swaggerize_args( $this->EDIT_args(), $POST_defaults ),
'responses' => [
'200' => [
'description' => 'Returns the updated Pod',
'content' => [
'application/json' => [
'schema' => [
'$ref' => '#/components/schemas/Pod',
],
],
],
],
'400' => [
'description' => 'The request was invalid or cannot be otherwise served',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
],
],
],
],
'401' => [
'description' => 'Unauthorized access - user does not have permission to update this Pod',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
],
],
],
],
'404' => [
'description' => 'The Pod to update was not found',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
],
],
],
],
],
],
'delete' => [
'summary' => 'Delete a specific Pod',
'parameters' => $this->swaggerize_args( $this->DELETE_args(), $POST_defaults ),
'responses' => [
'200' => [
'description' => 'Returns the deleted Pod details',
'content' => [
'application/json' => [
'schema' => [
'$ref' => '#/components/schemas/Pod',
],
],
],
],
'400' => [
'description' => 'The request was invalid or cannot be otherwise served',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
],
],
],
],
'401' => [
'description' => 'Unauthorized access - user does not have permission to delete this Pod',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
],
],
],
],
'404' => [
'description' => 'The Pod to delete was not found',
'content' => [
'application/json' => [
'schema' => [
'type' => 'object',
],
],
],
],
],
],
];
}
/**
* {@inheritdoc}
*
* @since 2.8.0
*/
public function READ_args() {
return [
'id' => [
'type' => 'integer',
'in' => 'path',
'description' => __( 'The Pod ID.', 'pods' ),
'required' => true,
'validate_callback' => [ $this->validator, 'is_pod_id' ],
],
'include_fields' => [
'type' => 'boolean',
'description' => __( 'Whether to include fields (default: off).', 'pods' ),
'default' => false,
'cli_boolean' => true,
],
'include_groups' => [
'type' => 'boolean',
'description' => __( 'Whether to include groups (default: off).', 'pods' ),
'default' => false,
'cli_boolean' => true,
],
'include_group_fields' => [
'type' => 'boolean',
'description' => __( 'Whether to include group fields (default: off).', 'pods' ),
'default' => false,
'cli_boolean' => true,
],
];
}
/**
* {@inheritdoc}
*
* @since 2.8.0
*/
public function get( WP_REST_Request $request ) {
return $this->get_by_args( 'id', 'id', $request );
}
/**
* Determine whether access to READ is available.
*
* @since 2.8.0
*
* @return bool Whether access to READ is available.
*/
public function can_read() {
return pods_is_admin( 'pods' );
}
/**
* {@inheritdoc}
*
* @since 2.8.0
*/
public function EDIT_args() {
return [
'id' => [
'type' => 'integer',
'in' => 'path',
'description' => __( 'The Pod ID.', 'pods' ),
'required' => true,
'validate_callback' => [ $this->validator, 'is_pod_id' ],
],
'name' => [
'type' => 'string',
'description' => __( 'The new name of the Pod.', 'pods' ),
],
'label' => [
'type' => 'string',
'description' => __( 'The singular label of the Pod.', 'pods' ),
],
'args' => [
'required' => false,
'description' => __( 'A list of additional options to save to the Pod.', 'pods' ),
'swagger_type' => 'array',
],
];
}
/**
* {@inheritdoc}
*
* @since 2.8.0
*/
public function update( WP_REST_Request $request ) {
if ( ! empty( $request['groups'] ) ) {
$request->set_param( 'groups', null );
}
if ( ! empty( $request['fields'] ) ) {
$request->set_param( 'fields', null );
}
return $this->update_by_args( 'id', 'id', $request );
}
/**
* {@inheritdoc}
*
* @since 2.8.0
*/
public function can_edit() {
return pods_is_admin( 'pods' );
}
/**
* {@inheritdoc}
*
* @since 2.8.0
*/
public function DELETE_args() {
return [
'id' => [
'type' => 'integer',
'in' => 'path',
'description' => __( 'The Pod ID.', 'pods' ),
'required' => true,
'validate_callback' => [ $this->validator, 'is_pod_id' ],
],
'delete_all' => [
'type' => 'boolean',
'description' => __( 'Whether to delete all content for Pod (default: off).', 'pods' ),
'default' => false,
'cli_boolean' => true,
],
];
}
/**
* {@inheritdoc}
*
* @since 2.8.0
*/
public function delete( WP_REST_Request $request ) {
return $this->delete_by_args( 'id', 'id', $request );
}
/**
* {@inheritdoc}
*
* @since 2.8.0
*/
public function can_delete() {
return pods_is_admin( 'pods' );
}
}