HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ubuntu-8gb-hel1-1 6.8.0-55-generic #57-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 12 23:42:21 UTC 2025 x86_64
User: www-data (33)
PHP: 8.1.32
Disabled: NONE
Upload Files
File: /var/www/agighana.org_backup/playlist_item.class.php
<?php

class UEGoogleAPIPlaylistItem extends UEGoogleAPIModel{

	const IMAGE_SIZE_DEFAULT = "default";
	const IMAGE_SIZE_MEDIUM = "medium";
	const IMAGE_SIZE_HIGH = "high";
	const IMAGE_SIZE_MAX = "maxres";

	/**
	 * Get the identifier.
	 *
	 * @return string
	 */
	public function getId(){

		$id = $this->getAttribute("id");

		return $id;
	}

	/**
	 * Get the title.
	 *
	 * @return string
	 */
	public function getTitle(){

		$title = $this->getSnippetValue("title");

		return $title;
	}

	/**
	 * Get the description.
	 *
	 * @param bool $asHtml
	 *
	 * @return string
	 */
	public function getDescription($asHtml = false){

		$description = $this->getSnippetValue("description");

		if($asHtml === true)
			$description = nl2br($description);

		return $description;
	}

	/**
	 * Get the date.
	 *
	 * @param string $format
	 *
	 * @return string
	 */
	public function getDate($format){

		$date = $this->getSnippetValue("publishedAt");
		$time = strtotime($date);
		$date = s_date($format, $time);

		return $date;
	}

	/**
	 * Get the image URL.
	 *
	 * @param string $size
	 *
	 * @return string
	 */
	public function getImageUrl($size){

		$images = $this->getSnippetValue("thumbnails");
		$image = UniteFunctionsUC::getVal($images, $size, array());
		$url = UniteFunctionsUC::getVal($image, "url");

		return $url;
	}

	/**
	 * Get the video identifier.
	 *
	 * @return string
	 */
	public function getVideoId(){

		$id = $this->getDetailsValue("videoId");

		return $id;
	}

	/**
	 * Get the video date.
	 *
	 * @param string $format
	 *
	 * @return string
	 */
	public function getVideoDate($format){

		$date = $this->getDetailsValue("videoPublishedAt");
		$time = strtotime($date);
		$date = s_date($format, $time);

		return $date;
	}

	/**
	 * Get the video URL.
	 *
	 * @return string
	 */
	public function getVideoUrl(){

		$id = $this->getVideoId();
		$url = "https://youtube.com/watch?v=$id";

		return $url;
	}

	/**
	 * Get the snippet value.
	 *
	 * @param string $key
	 * @param mixed $fallback
	 *
	 * @return mixed
	 */
	private function getSnippetValue($key, $fallback = null){

		$snippet = $this->getAttribute("snippet");
		$value = UniteFunctionsUC::getVal($snippet, $key, $fallback);

		return $value;
	}

	/**
	 * Get the details value.
	 *
	 * @param string $key
	 * @param mixed $fallback
	 *
	 * @return mixed
	 */
	private function getDetailsValue($key, $fallback = null){

		$details = $this->getAttribute("contentDetails");
		$value = UniteFunctionsUC::getVal($details, $key, $fallback);

		return $value;
	}

}