HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //proc/self/cwd/wp-content/plugins/pixel-caffeine/includes/functions-helpers.php
<?php
/**
 * Collection of helper functions
 *
 * @package Pixel Caffeine
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * Print the track code for a specific event
 *
 * @param string|array|object $args List of arguments of the event.
 *
 * @return string|null
 */
function aepc_pixel_event_code( $args = array() ) {
	$defaults = array(
		'event_id'         => '',
		'event_name'       => '',
		'value'            => '',
		'currency'         => '',
		'content_name'     => '',
		'content_category' => '',
		'content_ids'      => array(),
		'content_type'     => '',
		'num_items'        => '',
		'search_string'    => '',
		'status'           => '',
		'return'           => false,
	);

	// Set arguments.
	$args            = wp_parse_args( $args, $defaults );
	$standard_params = $args;

	// Set standard parameters.
	$standard_params = array_intersect_key( $standard_params, $defaults );

	// Get custom parameters.
	$custom_params = array_diff_key( $args, $standard_params );

	// Set standard parameters.
	foreach ( array( 'event_name', 'return' ) as $key ) {
		unset( $standard_params[ $key ], $custom_params[ $key ] );
	}

	// Get the event ID.
	if ( ! empty( $args['event_id'] ) ) {
		$standard_params['event_id'] = $args['event_id'];
	}

	// Get track code.
	$code = AEPC_Track::track( $args['event_name'], array_filter( $standard_params ), array_filter( $custom_params ) );

	// If option is on footer, must be returned and not printed.
	if ( 'footer' === get_option( 'aepc_pixel_position' ) ) {
		return null;
	}

	// Otherwise return according to argument.
	if ( ! $args['return'] ) {
		printf( "<script>\n\t%s\n</script>", wp_kses_post( $code ) );
	}

	// Anyway, unregister track.
	AEPC_Track::remove_event( $args['event_name'], 'last' );

	return $code;
}