SILENT KILLERPanel

Current Path: > home > codekrsu > > escapematrixonline.com > wp-content > plugins > > carousel-slider > includes


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/codekrsu//escapematrixonline.com/wp-content/plugins//carousel-slider/includes

NameTypeSizeLast ModifiedActions
Abstracts Directory - -
Admin Directory - -
CLI Directory - -
Frontend Directory - -
Integration Directory - -
Interfaces Directory - -
REST Directory - -
Supports Directory - -
Traits Directory - -
Widget Directory - -
Ajax.php File 874 bytes April 10 2025 09:40:10.
Api.php File 4685 bytes June 14 2024 19:04:34.
Assets.php File 5817 bytes April 10 2025 09:40:10.
Autoloader.php File 4124 bytes April 10 2025 09:40:10.
Helper.php File 14211 bytes April 10 2025 09:40:10.
Plugin.php File 7504 bytes April 10 2025 09:40:10.
TemplateParserBase.php File 4964 bytes April 10 2025 09:40:10.
TrackingData.php File 7011 bytes June 14 2024 19:04:34.
ViewHelper.php File 1345 bytes April 10 2025 09:40:10.

Reading File: /home/codekrsu//escapematrixonline.com/wp-content/plugins//carousel-slider/includes/Api.php

<?php

namespace CarouselSlider;

use WP_Error;

/**
 * Carousel Slider API.
 *
 * Carousel Slider API handler class is responsible for communicating with Carousel Slider
 * remote servers retrieving templates data and to send uninstall feedback.
 *
 * @since 2.1.0
 */
class Api {
	const BASE_URL         = 'https://api.carousel-slider.com/v1';
	const PRIVACY_URL      = 'https://carousel-slider.com/privacy-policy';
	const GO_PRO_URL       = 'https://carousel-slider.com/?utm_source=wp-menu&utm_campaign=gopro&utm_medium=wp-dash';
	const PRO_SUPPORT_URL  = 'https://carousel-slider.com/?utm_source=wp-menu&utm_campaign=pro-support&utm_medium=wp-dash';
	const FREE_SUPPORT_URL = 'https://wordpress.org/support/plugin/carousel-slider';

	/**
	 * Log error data to system
	 *
	 * @param  WP_Error $response  Log error data.
	 *
	 * @return void
	 */
	protected static function log_wp_error( WP_Error $response ) {
		error_log(
			wp_json_encode(
				[
					'message'      => $response->get_error_message(),
					'code'         => $response->get_error_code(),
					'request_url'  => $response->get_all_error_data( 'debug_request_url' ),
					'request_args' => $response->get_all_error_data( 'debug_request_args' ),
				],
				JSON_PRETTY_PRINT
			)
		);
	}

	/**
	 * Filter remote response
	 *
	 * @param  string         $url  The request URL.
	 * @param  array          $args  The request arguments.
	 * @param  array|WP_Error $response  The remote response or WP_Error object.
	 *
	 * @return array|WP_Error
	 */
	protected static function filter_remote_response( string $url, array $args, $response ) {
		if ( is_wp_error( $response ) ) {
			$response->add_data( $url, 'debug_request_url' );
			$response->add_data( $args, 'debug_request_args' );

			return $response;
		}

		$content_type  = wp_remote_retrieve_header( $response, 'Content-Type' );
		$response_code = (int) wp_remote_retrieve_response_code( $response );
		$response_body = wp_remote_retrieve_body( $response );
		if ( false !== strpos( $content_type, 'application/json' ) ) {
			$response_body = json_decode( $response_body, true );
		} elseif ( false !== strpos( $content_type, 'text/html' ) ) {
			$response_body = (array) $response_body;
		} else {
			$response_body = 'Unsupported content type: ' . $content_type;
		}

		if ( ! ( $response_code >= 200 && $response_code < 300 ) ) {
			$response_message = wp_remote_retrieve_response_message( $response );

			return new WP_Error(
				'rest_error',
				$response_message,
				[
					'debug_request_url'  => $url,
					'debug_request_args' => $args,
				]
			);
		}

		if ( ! is_array( $response_body ) ) {
			return new WP_Error(
				'unexpected_response_type',
				'Rest Client Error: unexpected response type',
				[
					'debug_request_url'  => $url,
					'debug_request_args' => $args,
				]
			);
		}

		return $response_body;
	}

	/**
	 * Send remote request
	 *
	 * @param  string $endpoint  The REST endpoint.
	 * @param  array  $data  The data to be sent.
	 *
	 * @return array|WP_Error
	 */
	public static function send_request( string $endpoint, array $data = [] ) {
		$endpoint = self::BASE_URL . '/' . ltrim( $endpoint, '/' );
		$data     = wp_parse_args(
			$data,
			[
				'api_version' => CAROUSEL_SLIDER_VERSION,
				'site_lang'   => get_bloginfo( 'language' ),
				'wp_version'  => get_bloginfo( 'version' ),
				'site_url'    => esc_url( home_url() ),
			]
		);

		$response = wp_remote_post(
			$endpoint,
			[
				'method'      => 'POST',
				'timeout'     => 30,
				'redirection' => 5,
				'httpversion' => '1.0',
				'blocking'    => false,
				'body'        => $data,
			]
		);

		return static::filter_remote_response( $endpoint, $data, $response );
	}

	/**
	 * Send Feedback.
	 * Fires a request to Carousel Slider server with the feedback data.
	 *
	 * @param  string $feedback_key  Feedback key.
	 * @param  string $feedback_text  Feedback text.
	 *
	 * @return array The response of the request.
	 * @since 2.1.0
	 */
	public static function send_deactivation_feedback( $feedback_key, $feedback_text ) {
		$response = self::send_request(
			'feedback',
			[
				'feedback_key' => $feedback_key,
				'feedback'     => $feedback_text,
			]
		);
		if ( is_wp_error( $response ) ) {
			static::log_wp_error( $response );
		}

		return $response;
	}

	/**
	 * Send tracking to remote site.
	 *
	 * @param  array $data  The tracking data.
	 *
	 * @return array|WP_Error The response of the request.
	 * @since 2.1.0
	 */
	public static function send_tracking_data( array $data ) {
		$response = self::send_request( 'tracker', $data );
		if ( is_wp_error( $response ) ) {
			static::log_wp_error( $response );
		}

		return $response;
	}
}

SILENT KILLER Tool