HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
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: /var/www/shoetique/wp-content/plugins/googleanalytics/class/class-ga-frontend.php
<?php
/**
 * GoogleAnalytics Frontend.
 *
 * @package GoogleAnalytics
 */

/**
 * Frontend.
 */
class Ga_Frontend {

	const GA_SHARETHIS_PLATFORM_URL = '//platform-api.sharethis.com/js/sharethis.js#source=googleanalytics-wordpress';

	/**
	 * Platform ShareThis.
	 *
	 * @return void
	 */
	public static function platform_sharethis() {
		$url = self::GA_SHARETHIS_PLATFORM_URL . '#product=ga';
		if ( get_option( Ga_Admin::GA_SHARETHIS_PROPERTY_ID ) ) {
			$url = $url . '&property=' . get_option( Ga_Admin::GA_SHARETHIS_PROPERTY_ID );
		}

		wp_register_script( GA_NAME . '-platform-sharethis', $url, null, null, false ); // phpcs:ignore
		wp_enqueue_script( GA_NAME . '-platform-sharethis' );
	}

	/**
	 * Adds frontend actions hooks.
	 */
	public static function add_actions() {
		if ( Ga_Helper::are_features_enabled() ) {
			add_action( 'wp_enqueue_scripts', 'Ga_Frontend::platform_sharethis' );
		}
		add_action( 'wp_head', 'Ga_Frontend::insert_ga_script' );
	}

	/**
	 * Insert GoogleAnalytics script.
	 *
	 * @return void
	 */
	public static function insert_ga_script() {
		if ( true === Ga_Helper::can_add_ga_code() || true === Ga_Helper::is_all_feature_disabled() ) {
			$web_property_id = self::get_web_property_id();
			$optimize        = get_option( 'googleanalytics_optimize_code' );
			$anonymization   = get_option( 'googleanalytics_ip_anonymization' );
			$debug_mode_on   = 'on' === get_option( 'googleanalytics_enable_debug_mode', 'off' );

			if ( Ga_Helper::should_load_ga_javascript( $web_property_id ) ) {
				$data = array(
					Ga_Admin::GA_WEB_PROPERTY_ID_OPTION_NAME => $web_property_id,
					'optimize'      => $optimize,
					'anonymization' => $anonymization,
				);

				include plugin_dir_path( __FILE__ ) . '../view/ga-code.php';
			}
		}
	}

	/**
	 * Gets and returns Web Property Id.
	 *
	 * @return string Web Property Id
	 */
	public static function get_web_property_id() {
		$web_property_id = get_option( Ga_Admin::GA_WEB_PROPERTY_ID_OPTION_NAME );
		if ( true === Ga_Helper::is_code_manually_enabled() || true === Ga_Helper::is_all_feature_disabled() ) {
			$web_property_id = get_option( Ga_Admin::GA_WEB_PROPERTY_ID_MANUALLY_VALUE_OPTION_NAME );
		}

		return $web_property_id;
	}
}