Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
post-date
/
wp-content
/
plugins
/
flexible-shipping
/
src
/
WPDesk
/
FS
/
TableRate
/
Beacon
:
BeaconDeactivationTracker.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php /** * Deactivation tracker data. * * @package WPDesk\FS\TableRate */ namespace WPDesk\FS\TableRate\Beacon; use FSVendor\WPDesk\PluginBuilder\Plugin\Hookable; /** * Can add beacon data to deactivation tracker data. */ class BeaconDeactivationTracker implements Hookable { const ADDITIONAL_DATA = 'additional_data'; /** * Hooks. */ public function hooks() { add_filter( 'wpdesk_tracker_deactivation_data', [ $this, 'append_beacon_data_to_deactivation_tracker' ] ); } /** * Set new rules table data to data array. * * @param array $data Data. * * @return array * @internal */ public function append_beacon_data_to_deactivation_tracker( array $data ) { if ( empty( $data[ self::ADDITIONAL_DATA ] ) || ! is_array( $data[ self::ADDITIONAL_DATA ] ) ) { $data[ self::ADDITIONAL_DATA ] = []; } $data[ self::ADDITIONAL_DATA ]['beacon'] = [ 'clicked' => 1 === (int) get_option( BeaconClickedAjax::OPTION_NAME, 0 ) ? 'yes' : 'no' ]; return $data; } }