403Webshell
Server IP : 146.59.209.152  /  Your IP : 216.73.216.46
Web Server : Apache
System : Linux webm005.cluster131.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User : infrafs ( 43850)
PHP Version : 8.2.29
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/infrafs/bike/wp-content/plugins/colibri-page-builder/extend-builder/api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/infrafs/bike/wp-content/plugins/colibri-page-builder/extend-builder/api/post.php
<?php

namespace ExtendBuilder;

class PostApi {


	public function autoDraftDelete($req = []) {
		$uuid = isset($req['uuid']) ? $req['uuid'] : null;
		if(!$uuid) {
			return $this->error();
		}
		$postId = $this->find_changeset_post_id_for_auto_draft($uuid);
		if(!$postId) {
			return $this->error();
		}
		$result = wp_trash_post($postId);
		if(!$result) {
			return $this->error();
		}
		return $this->success();
	}

	private function success($data = []) {
		$data =  [
			'success' =>  true,
			'data' => $data
		];

		return  json_encode( $data );
	}

	private function error($data = []) {
		$data =  [
			'success' =>  false,
			'data' => $data
		];

		return  json_encode( $data );
	}

	private function find_changeset_post_id_for_auto_draft($uuid) {
		$cache_group       = 'customize_changeset_post';
		$changeset_post_id = wp_cache_get( $uuid, $cache_group );
		if ( $changeset_post_id && 'customize_changeset' === get_post_type( $changeset_post_id ) ) {
			return $changeset_post_id;
		}

		$changeset_post_query = new \WP_Query(
			array(
				'post_type'              => 'customize_changeset',
				'post_status'            => 'auto-draft',
				'name'                   => $uuid,
				'posts_per_page'         => 1,
				'no_found_rows'          => true,
				'cache_results'          => true,
				'update_post_meta_cache' => false,
				'update_post_term_cache' => false,
				'lazy_load_term_meta'    => false,
			)
		);
		if ( ! empty( $changeset_post_query->posts ) ) {
			// Note: 'fields'=>'ids' is not being used in order to cache the post object as it will be needed.
			$changeset_post_id = $changeset_post_query->posts[0]->ID;
			wp_cache_set( $uuid, $changeset_post_id, $cache_group );
			return $changeset_post_id;
		}

		return null;
	}


}

Api::addEndPoint("post", new PostApi());




Youez - 2016 - github.com/yon3zu
LinuXploit