HEX
Server: LiteSpeed
System: Linux php-prod-3.spaceapp.ru 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: sarli3128 (1010)
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: /home/sarlight.ru/public_html/wp-content/plugins/video-popup/features/sc_support.php
<?php

defined( 'ABSPATH' ) or die(':)');


function video_popup_support_soundcloud(){
	if( isset($_GET['vp_soundcloud']) ){

		$url = $_GET['vp_soundcloud'];

		if( filter_var($url, FILTER_VALIDATE_URL) === false ){
			exit();
		}

		if( !preg_match("/(soundcloud.com)/", $url) ){
			exit();
		}

		if( isset($_GET['vp_soundcloud_a']) and $_GET['vp_soundcloud_a'] == 'true' ){
			$auto_play = 'true';
		}else{
			$auto_play = 'false';
		}

		$get = wp_remote_get("http://soundcloud.com/oembed?url=$url&format=json&auto_play=$auto_play");

		$retrieve = wp_remote_retrieve_body($get);
		$result = json_decode($retrieve, true);

		if( preg_match("/(errors)+/", $retrieve) ){
			return false;
		}

		$track_html = $result['html'];

		preg_match_all('~src="(.*)"~', $track_html, $matches);

		$track_link = esc_url($matches[1][0]);

		$ex = explode('url', $track_link);

		$eq = preg_replace("/(&)+(.*)/", null, $ex[1]);

		$remove_eq = str_replace('=', null, $eq);

		wp_redirect("https://w.soundcloud.com/player/?visual=true&url=$remove_eq&show_artwork=true&auto_play=$auto_play");

		exit();
	}
}
add_action('init', 'video_popup_support_soundcloud');