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/lipovac/wp-content/plugins/the-events-calendar/src/Tribe/Aggregator/API/Requests.php
<?php


/**
 * Class Tribe__Events__Aggregator__API__Requests
 *
 * Encapsulates the WordPress HTTP API.
 */
class Tribe__Events__Aggregator__API__Requests {
	/**
	 * Builds and returns the custom headers needed to identify the site in the service.
	 *
	 * @since 4.6.2
	 *
	 * @return array
	 */
	public function get_site_headers() {
		$site      = parse_url( home_url() );
		$x_ea_site = ! empty( $site['path'] ) ? $site['host'] . $site['path'] : $site['host'];

		return array( 'X-EA-Site' => $x_ea_site );
	}

	/**
	 * Retrieve the raw response from the HTTP request using the GET method.
	 *
	 * @param string $url  Site URL to retrieve.
	 * @param array  $args Optional. Request arguments. Default empty array.
	 *
	 * @return array|WP_Error
	 */
	public function get( $url, $args = array() ) {
		$site_headers = $this->get_site_headers();

		if ( empty( $args['headers'] ) ) {
			$args['headers'] = $site_headers;
		} else {
			$args['headers'] = array_merge( $args['headers'], $site_headers );
		}

		$response = wp_remote_get( $url, $args );

		return $response;
	}

	/**
	 * Retrieve the raw response from the HTTP request using the POST method.
	 *
	 * @since 4.6.2
	 *
	 * @param string $url  Site URL to retrieve.
	 * @param array  $args Optional. Request arguments. Default empty array.
	 *
	 * @return array|WP_Error
	 */
	public function post( $url, $args = array() ) {
		$site_headers = $this->get_site_headers();

		if ( empty( $args['headers'] ) ) {
			$args['headers'] = $site_headers;
		} else {
			$args['headers'] = array_merge( $args['headers'], $site_headers );
		}

		$response = wp_remote_post( $url, $args );

		return $response;
	}
}