Server IP : 63.250.38.98 / Your IP : 216.73.216.80 Web Server : LiteSpeed System : Linux premium291.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64 User : samejjip ( 1289) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/samejjip/www/wp-content/plugins/pixelyoursite/modules/facebook/ |
Upload File : |
<?php namespace PixelYourSite; defined('ABSPATH') or die('Direct access not allowed'); class FacebookAsyncTask extends \WP_Async_Task { protected $action = 'pys_send_server_event'; protected function prepare_data($data) { try { if (!empty($data)) { if (empty($this->_body_data)) { return array('data' => base64_encode(serialize($data))); } else { $oldData = unserialize(base64_decode($this->_body_data['data']), ['allowed_classes' => [ 'PYS_PRO_GLOBAL\FacebookAds\Object\ServerSide\Event', 'PYS_PRO_GLOBAL\FacebookAds\Object\ServerSide\UserData', 'PYS_PRO_GLOBAL\FacebookAds\Object\ServerSide\CustomData', 'PYS_PRO_GLOBAL\FacebookAds\Object\ServerSide\Content' ]]); // Check if $oldData[0] and $data[0] are arrays before merging if (is_array($oldData[0]) && is_array($data[0])) { $data = [ array_merge( $oldData[ 0 ], $data[ 0 ] ) ]; } return array( 'data' => base64_encode( serialize( $data ) ) ); } } } catch (\Exception $ex) { error_log($ex); } return array(); } protected function run_action() { try { $data = unserialize(base64_decode($_POST['data']), ['allowed_classes' => [ 'PYS_PRO_GLOBAL\FacebookAds\Object\ServerSide\Event', 'PYS_PRO_GLOBAL\FacebookAds\Object\ServerSide\UserData', 'PYS_PRO_GLOBAL\FacebookAds\Object\ServerSide\CustomData', 'PYS_PRO_GLOBAL\FacebookAds\Object\ServerSide\Content' ]]); $events = is_array($data[0]) ? $data[0] : $data ; if (empty($events)) { return; } foreach ($events as $event) { FacebookServer()->sendEvent($event["pixelIds"],$event["event"]); } } catch (\Exception $ex) { error_log($ex); } } }