Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/leadin/public/admin/modules/api
File: class-user-meta-api-controller.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Leadin\admin\api;
[2] Fix | Delete
[3] Fix | Delete
use Leadin\api\Base_Api_Controller;
[4] Fix | Delete
use Leadin\data\User_Metadata;
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* User meta review Api, used to set the user metadata.
[8] Fix | Delete
*/
[9] Fix | Delete
class User_Meta_Api_Controller extends Base_Api_Controller {
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* Class constructor, register route.
[13] Fix | Delete
*/
[14] Fix | Delete
public function __construct() {
[15] Fix | Delete
self::register_leadin_route(
[16] Fix | Delete
'/skip-review',
[17] Fix | Delete
\WP_REST_Server::CREATABLE,
[18] Fix | Delete
array( $this, 'skip_review' )
[19] Fix | Delete
);
[20] Fix | Delete
self::register_leadin_route(
[21] Fix | Delete
'/track-consent',
[22] Fix | Delete
\WP_REST_Server::CREATABLE,
[23] Fix | Delete
array( $this, 'track_consent' )
[24] Fix | Delete
);
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
/**
[28] Fix | Delete
* Skip Review. Sets SKIP_REVIEW meta data for a user with current datetime.
[29] Fix | Delete
*/
[30] Fix | Delete
public function skip_review() {
[31] Fix | Delete
User_Metadata::set_skip_review( time() );
[32] Fix | Delete
return new \WP_REST_Response( 'OK', 200 );
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
/**
[36] Fix | Delete
* Used to set user consent on HubSpot anonymous tracking.
[37] Fix | Delete
*
[38] Fix | Delete
* @param array $request Request body.
[39] Fix | Delete
*/
[40] Fix | Delete
public function track_consent( $request ) {
[41] Fix | Delete
$data = json_decode( $request->get_body(), true );
[42] Fix | Delete
if ( array_key_exists( 'canTrack', $data ) ) {
[43] Fix | Delete
$consent = $data['canTrack'];
[44] Fix | Delete
User_Metadata::set_track_consent( $consent ? 'true' : 'false' );
[45] Fix | Delete
}
[46] Fix | Delete
return new \WP_REST_Response(
[47] Fix | Delete
json_encode( User_Metadata::get_track_consent(), true ),
[48] Fix | Delete
200
[49] Fix | Delete
);
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
}
[53] Fix | Delete
[54] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function