Warning: chmod(): No such file or directory in /www/wwwroot/scuipturepactory.com/wp-content/mu-plugins/worksec.php on line 7
Uname:Linux iZt4n9czhka2zvqfajdlr2Z 6.8.0-63-generic #66-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 13 20:25:30 UTC 2025 x86_64

Base Dir : /www/wwwroot/scuipturepactory.com

User : www


403WebShell
403Webshell
Server IP : 47.82.179.145  /  Your IP : 216.73.217.129
Web Server : nginx/1.26.3
System : Linux iZt4n9czhka2zvqfajdlr2Z 6.8.0-63-generic #66-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 13 20:25:30 UTC 2025 x86_64
User : www ( 1001)
PHP Version : 8.3.30
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wwwroot/scuipturepactory.com/wp-content/plugins.off/sureforms/inc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/scuipturepactory.com/wp-content/plugins.off/sureforms/inc//analytics-events.php
<?php
/**
 * Analytics Events helper for one-time milestone tracking.
 *
 * Tracks events temporarily, sends them once via BSF Analytics,
 * then cleans up. Only a minimal dedup flag remains.
 *
 * @package sureforms.
 * @since 2.5.1
 */

namespace SRFM\Inc;

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

/**
 * Analytics Events Class.
 *
 * @since 2.5.1
 */
class Analytics_Events {
	/**
	 * Track a one-time event. Skips if already tracked or pending.
	 * Only stores temporary data — cleaned up after analytics send.
	 *
	 * @param string               $event_name  Event identifier.
	 * @param string               $event_value Primary value (version, form ID, mode, etc.).
	 * @param array<string, mixed> $properties Additional context as key-value pairs.
	 * @since 2.5.1
	 * @return void
	 */
	public static function track( $event_name, $event_value = '', $properties = [] ) {
		// Check dedup flag — already sent in a previous cycle.
		$pushed = Helper::get_srfm_option( 'usage_events_pushed', [] );
		$pushed = is_array( $pushed ) ? $pushed : [];
		if ( in_array( $event_name, $pushed, true ) ) {
			return;
		}

		// Check if already queued in current cycle.
		$pending = Helper::get_srfm_option( 'usage_events_pending', [] );
		$pending = is_array( $pending ) ? $pending : [];
		if ( in_array( $event_name, array_column( $pending, 'event_name' ), true ) ) {
			return;
		}

		// Add to pending queue.
		$pending[] = [
			'event_name'  => sanitize_text_field( $event_name ),
			'event_value' => sanitize_text_field( (string) $event_value ),
			'properties'  => ! empty( $properties ) ? $properties : new \stdClass(),
			'date'        => current_time( 'mysql' ),
		];
		Helper::update_srfm_option( 'usage_events_pending', $pending );
	}

	/**
	 * Flush pending events: returns them for the payload, then cleans up.
	 *
	 * After this call:
	 * - usage_events_pending is EMPTY (full event data deleted).
	 * - usage_events_pushed has event_name strings added (minimal dedup).
	 *
	 * @since 2.5.1
	 * @return array Pending events to include in payload. Empty if none.
	 */
	public static function flush_pending() {
		$pending = Helper::get_srfm_option( 'usage_events_pending', [] );
		if ( empty( $pending ) || ! is_array( $pending ) ) {
			return [];
		}

		// Add event names to dedup flag (minimal — just strings).
		$pushed = Helper::get_srfm_option( 'usage_events_pushed', [] );
		$pushed = is_array( $pushed ) ? $pushed : [];
		$pushed = array_unique(
			array_merge( $pushed, array_column( $pending, 'event_name' ) )
		);
		Helper::update_srfm_option( 'usage_events_pushed', $pushed );

		// DELETE all temporary event data.
		Helper::update_srfm_option( 'usage_events_pending', [] );

		return $pending;
	}

	/**
	 * Check if an event has already been tracked (sent or pending).
	 *
	 * @param string $event_name Event identifier.
	 * @since 2.5.1
	 * @return bool
	 */
	public static function is_tracked( $event_name ) {
		$pushed = Helper::get_srfm_option( 'usage_events_pushed', [] );
		$pushed = is_array( $pushed ) ? $pushed : [];
		if ( in_array( $event_name, $pushed, true ) ) {
			return true;
		}

		$pending = Helper::get_srfm_option( 'usage_events_pending', [] );
		$pending = is_array( $pending ) ? $pending : [];
		return in_array( $event_name, array_column( $pending, 'event_name' ), true );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit