HEX
Server: Apache
System: Linux vps-cdc32557.vps.ovh.ca 5.15.0-156-generic #166-Ubuntu SMP Sat Aug 9 00:02:46 UTC 2025 x86_64
User: hanode (1017)
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/hanode/public_html/wp-content/plugins/carousel-slider/modules/VideoCarousel/Item.php
<?php

namespace CarouselSlider\Modules\VideoCarousel;

use CarouselSlider\Abstracts\Data;

/**
 * Item class
 */
class Item extends Data {
	/**
	 * Default data
	 *
	 * @var string[]
	 */
	protected $defaults = [
		'provider'  => '',
		'url'       => '',
		'video_id'  => '',
		'thumbnail' => '',
	];

	/**
	 * Class constructor
	 *
	 * @param array $data Video item data.
	 */
	public function __construct( array $data = [] ) {
		$this->data = wp_parse_args( $data, $this->defaults );
	}

	/**
	 * Get video provider
	 *
	 * @return string
	 */
	public function get_provider(): string {
		return $this->get_prop( 'provider' );
	}

	/**
	 * Get video id
	 *
	 * @return string|int youtube, vimeo or integer value for self hosted video.
	 */
	public function get_video_id() {
		return $this->get_prop( 'video_id' );
	}

	/**
	 * Get video url
	 *
	 * @return string
	 */
	public function get_url(): string {
		return $this->get_prop( 'url' );
	}

	/**
	 * Get video embed url
	 *
	 * @return string
	 */
	public function get_embed_url(): string {
		if ( 'youtube' === $this->get_provider() ) {
			return sprintf( '//youtube.com/embed/%s?autoplay=1', $this->get_video_id() );
		}
		if ( 'vimeo' === $this->get_provider() ) {
			return sprintf( '//player.vimeo.com/video/%s?autoplay=1', $this->get_video_id() );
		}

		return '//about:blank';
	}

	/**
	 * Get video thumbnail
	 *
	 * @param string $size Image size.
	 *
	 * @return string
	 */
	public function get_thumbnail_url( string $size = 'large' ): string {
		$thumbnail = $this->get_prop( 'thumbnail' );

		return $thumbnail[ $size ] ?? '';
	}
}