MMCT TEAM
Server IP : 111.118.215.189  /  Your IP : 216.73.216.89
Web Server : Apache
System : Linux md-in-83.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : a1673wkz ( 2475)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /proc/thread-self/root/opt/wp/plugins/bluehost-wordpress-plugin/inc/RestApi/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //proc/thread-self/root/opt/wp/plugins/bluehost-wordpress-plugin/inc/RestApi/MojoItemController.php
<?php

namespace Bluehost\RestApi;

/**
 * Class MojoItemController
 */
class MojoItemController extends MojoItemsController {

	/**
	 * Register the routes for the objects of the controller.
	 */
	public function register_routes() {
		register_rest_route(
			$this->namespace,
			'/' . $this->rest_base,
			array(
				array(
					'methods'             => \WP_REST_Server::READABLE,
					'callback'            => array( $this, 'query_mojo_item' ),
					'permission_callback' => array( $this, 'get_items_permissions_check' ),
					'args'                => array(
						'id' => array(
							'required' => true,
						),
					),
				),
			)
		);
	}

	/**
	 * Query the Mojo items endpoint.
	 *
	 * @param \WP_REST_Request $request Request model.
	 *
	 * @return array
	 */
	public function query_mojo_item( \WP_REST_Request $request ) {
		$api_url      = 'https://api.mojomarketplace.com/api/v2/items/' . $request['id'];
		$api_response = bh_api_cache( $api_url );

		return $this->get_response( $api_response );
	}

}

MMCT - 2023