403Webshell
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wp-content/plugins/pods/src/Pods/REST/V1/Endpoints/Pods.php
<?php

namespace Pods\REST\V1\Endpoints;

// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
	die( '-1' );
}

use Pods\REST\Interfaces\Endpoints\CREATE_Interface;
use Pods\REST\Interfaces\Endpoints\READ_Interface;
use Pods\REST\Interfaces\Swagger\Provider_Interface;
use WP_Error;
use WP_REST_Request;

class Pods extends Base implements READ_Interface, CREATE_Interface, Provider_Interface {

	/**
	 * {@inheritdoc}
	 *
	 * @since 2.8.0
	 */
	public $route = '/pods';

	/**
	 * {@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 collection of Pods',
				'parameters' => $this->swaggerize_args( $this->READ_args(), $GET_defaults ),
				'responses'  => [
					'200' => [
						'description' => 'Returns a collection of Pods matching the request',
						'content'     => [
							'application/json' => [
								'schema' => [
									'type'       => 'object',
									'properties' => [
										'pods' => [
											'type'  => 'array',
											'items' => [ '$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 Pods',
						'content'     => [
							'application/json' => [
								'schema' => [
									'type' => 'object',
								],
							],
						],
					],
				],
			],
			'post' => [
				'summary'    => 'Create a new Pod',
				'parameters' => $this->swaggerize_args( $this->CREATE_args(), $POST_defaults ),
				'responses'  => [
					'201' => [
						'description' => 'Returns the newly created 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 create Pods',
						'content'     => [
							'application/json' => [
								'schema' => [
									'type' => 'object',
								],
							],
						],
					],
					'403' => [
						'description' => 'Forbidden - creation of this Pod is not allowed',
						'content'     => [
							'application/json' => [
								'schema' => [
									'type' => 'object',
								],
							],
						],
					],
				],
			],
		];
	}

	/**
	 * {@inheritdoc}
	 *
	 * @since 2.8.0
	 */
	public function READ_args() {
		return [
			'return_type' => [
				'description' => __( 'The type of data to return.', 'pods' ),
				'type'        => 'string',
				'default'     => 'full',
				'required'    => false,
				'enum'        => [
					'full',
					'names',
					'ids',
					'count',
				],
			],
			'types'       => [
				'required'         => false,
				'description'      => __( 'A list of types to filter by.', 'pods' ),
				'swagger_type'     => 'array',
				'items'            => [
					'type' => 'string',
				],
				'collectionFormat' => 'csv',
			],
			'ids'         => [
				'required'         => false,
				'description'      => __( 'A list of IDs to filter by.', 'pods' ),
				'swagger_type'     => 'array',
				'items'            => [
					'type' => 'integer',
				],
				'collectionFormat' => 'csv',
			],
			'args'        => [
				'required'     => false,
				'description'  => __( 'A list of arguments to filter by.', 'pods' ),
				'swagger_type' => 'array',
			],
		];
	}

	/**
	 * {@inheritdoc}
	 *
	 * @since 2.8.0
	 */
	public function get( WP_REST_Request $request ) {
		return $this->archive_by_args( $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 CREATE_args() {
		return [
			'mode'           => [
				'type'        => 'string',
				'description' => __( 'The mode for creating the Pod.', 'pods' ),
				'default'     => 'create',
				'enum'        => [
					'create',
					'extend',
				],
			],
			'name'           => [
				'type'        => 'string',
				'description' => __( 'The name of the Pod.', 'pods' ),
			],
			'label'          => [
				'type'        => 'string',
				'description' => __( 'The plural label of the Pod.', 'pods' ),
			],
			'type'           => [
				'type'        => 'string',
				'description' => __( 'The type of the Pod.', 'pods' ),
				'enum'        => array_keys( pods_api()->get_pod_types() ),
				'required'    => true,
			],
			'storage'        => [
				'type'        => 'string',
				'description' => __( 'The storage used for the Pod.', 'pods' ),
				'default'     => 'meta',
				'enum'        => [
					'meta',
					'table',
					'option',
					'none',
				],
			],
			'label_singular' => [
				'type'        => 'string',
				'description' => __( 'The singular label of the Pod.', 'pods' ),
			],
			'menu_name'      => [
				'type'        => 'string',
				'description' => __( 'The menu label of the Pod.', 'pods' ),
			],
			'menu_location'  => [
				'type'        => 'string',
				'description' => __( 'The menu location of the Pod.', 'pods' ),
			],
		];
	}

	/**
	 * {@inheritdoc}
	 *
	 * @since 2.8.0
	 */
	public function create( WP_REST_REQUEST $request, $return_id = false ) {
		if ( ! empty( $request['groups'] ) ) {
			$request->set_param( 'groups', null );
		}

		if ( ! empty( $request['fields'] ) ) {
			$request->set_param( 'fields', null );
		}

		$mode    = $request->get_param( 'mode' );
		$type    = $request->get_param( 'type' );
		$storage = $request->get_param( 'storage' );

		if ( 'extend' === $mode ) {
			$params = [
				'create_extend'   => 'extend',
				'extend_pod_type' => $type,
				'extend_storage'  => $storage,
			];

			$name = $request->get_param( 'name' );

			if ( 'post_type' === $params['extend_pod_type'] ) {
				$params['extend_post_type'] = $name;
			} elseif ( 'taxonomy' === $params['extend_pod_type'] ) {
				$params['extend_taxonomy'] = $name;
			} elseif ( 'table' === $params['extend_pod_type'] ) {
				$params['extend_table'] = $name;
			} elseif ( in_array( $params['extend_pod_type'], [ 'pod', 'settings' ], true ) ) {
				return new WP_Error( 'rest-object-extend-type-not-supported', __( 'Pod type not supported for extending.', 'pods' ) );
			}
		} else {
			$params = [
				'create_extend'         => 'create',
				'create_pod_type'       => $type,
				'create_storage'        => $storage,
				'create_label_plural'   => $request->get_param( 'label' ),
				'create_label_singular' => $request->get_param( 'label_singular' ),
				'create_label_menu'     => $request->get_param( 'menu_name' ),
				'create_menu_location'  => $request->get_param( 'menu_location' ),
			];

			if ( 'settings' === $params['create_pod_type'] ) {
				$params['create_label_title'] = $params['create_label_plural'];
			}

			$name = $request->get_param( 'name' );

			if ( 'settings' === $params['create_pod_type'] ) {
				$params['create_setting_name'] = $name;
				$params['create_storage']      = 'option';
			} else {
				$params['create_name'] = $name;
			}
		}

		$api = pods_api();

		$api->display_errors = 'wp_error';

		$id = $api->add_pod( $params );

		if ( is_wp_error( $id ) ) {
			return $id;
		}

		if ( empty( $id ) ) {
			// translators: %s is the object type.
			return new WP_Error( 'rest-object-not-added', sprintf( __( '%s not added.', 'pods' ), ucwords( $this->object ) ) );
		}

		return $this->get_by_args( [
			'id' => $id,
		], 'id', null, $return_id );
	}

	/**
	 * {@inheritdoc}
	 *
	 * @since 2.8.0
	 */
	public function can_create() {
		return pods_is_admin( 'pods' );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit