Edit File by line
/home/zeestwma/ceyloniy.../wp-conte.../plugins/elemento.../modules/cloud-ki.../data
File: controller.php
<?php
[0] Fix | Delete
namespace Elementor\Modules\CloudKitLibrary\Data;
[1] Fix | Delete
[2] Fix | Delete
use Elementor\Modules\CloudKitLibrary\Connect\Cloud_Kits;
[3] Fix | Delete
use Elementor\Modules\CloudKitLibrary\Module as CloudKitLibrary;
[4] Fix | Delete
use Elementor\App\Modules\KitLibrary\Data\Base_Controller;
[5] Fix | Delete
use Elementor\Core\Utils\Collection;
[6] Fix | Delete
[7] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[8] Fix | Delete
exit; // Exit if accessed directly.
[9] Fix | Delete
}
[10] Fix | Delete
[11] Fix | Delete
class Controller extends Base_Controller {
[12] Fix | Delete
[13] Fix | Delete
public function get_name() {
[14] Fix | Delete
return 'cloud-kits';
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
public function get_items( $request ) {
[18] Fix | Delete
$data = $this->get_app()->get_all();
[19] Fix | Delete
[20] Fix | Delete
if ( is_wp_error( $data ) ) {
[21] Fix | Delete
return [
[22] Fix | Delete
'data' => [],
[23] Fix | Delete
];
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
$kits = ( new Collection( $data ) )->map( function ( $kit ) {
[27] Fix | Delete
return [
[28] Fix | Delete
'id' => $kit['id'],
[29] Fix | Delete
'title' => $kit['title'],
[30] Fix | Delete
'thumbnail_url' => $kit['thumbnailUrl'],
[31] Fix | Delete
'created_at' => $kit['createdAt'],
[32] Fix | Delete
'updated_at' => $kit['updatedAt'],
[33] Fix | Delete
'status' => isset( $kit['status'] ) ? $kit['status'] : 'active',
[34] Fix | Delete
];
[35] Fix | Delete
} );
[36] Fix | Delete
[37] Fix | Delete
return [
[38] Fix | Delete
'data' => $kits->values(),
[39] Fix | Delete
];
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
public function delete_item( $request ) {
[43] Fix | Delete
return [
[44] Fix | Delete
'data' => $this->get_app()->delete_kit( $request->get_param( 'id' ) ),
[45] Fix | Delete
];
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
public function get_item( $request ) {
[49] Fix | Delete
return [
[50] Fix | Delete
'data' => $this->get_app()->get_kit( [ 'id' => $request->get_param( 'id' ) ] ),
[51] Fix | Delete
];
[52] Fix | Delete
}
[53] Fix | Delete
[54] Fix | Delete
public function register_endpoints() {
[55] Fix | Delete
$this->index_endpoint->register_item_route( \WP_REST_Server::DELETABLE, [
[56] Fix | Delete
'id' => [
[57] Fix | Delete
'description' => 'Unique identifier for the object.',
[58] Fix | Delete
'type' => 'integer',
[59] Fix | Delete
'required' => true,
[60] Fix | Delete
],
[61] Fix | Delete
] );
[62] Fix | Delete
[63] Fix | Delete
$this->register_endpoint( new Endpoints\Eligibility( $this ) );
[64] Fix | Delete
$this->register_endpoint( new Endpoints\Quota( $this ) );
[65] Fix | Delete
}
[66] Fix | Delete
[67] Fix | Delete
public function get_permission_callback( $request ) {
[68] Fix | Delete
return current_user_can( 'manage_options' );
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
protected function get_app(): Cloud_Kits {
[72] Fix | Delete
return CloudKitLibrary::get_app();
[73] Fix | Delete
}
[74] Fix | Delete
}
[75] Fix | Delete
[76] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function