403Webshell
Server IP : 82.64.35.208  /  Your IP : 192.168.65.1
Web Server : Apache/2.4.68 (Debian)
System : Linux 079bc81edf51 6.12.76-linuxkit #1 SMP Tue Jul 21 14:38:37 UTC 2026 aarch64
User : root ( 0)
PHP Version : 8.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/html/wp-content/plugins/custom-twitter-feeds/inc/V2/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/plugins/custom-twitter-feeds/inc/V2/MediaAdapter.php
<?php

namespace TwitterFeed\V2;

/**
 * Class for converting media attribute from Twitter API v1.1 to v2.
 *
 * @package twitter-api-v2
 */
class MediaAdapter
{
	/**
	 * Tweet data.
	 *
	 * @var array
	 */
	protected $tweet;

	/**
	 * Included media.
	 *
	 * @var array
	 */
	protected $included_media;

	/**
	 * Constructor.
	 *
	 * @param array $tweet Tweet data.
	 * @param array $included_media Included media data.
	 */
	public function __construct($tweet, $included_media)
	{
		$this->tweet          = $tweet;
		$this->included_media = $included_media;
	}

	/**
	 * Get media keys.
	 *
	 * @return array
	 */
	public function getMediaKeys()
	{
		return ! empty($this->tweet['attachments']['media_keys']) ? $this->tweet['attachments']['media_keys'] : [];
	}

	/**
	 * Convert.
	 *
	 * @return array
	 */
	public function convert()
	{
		$media_array = [];

		foreach ($this->getMediaKeys() as $media_key_index => $media_key_value) {
			$media_index = array_search(
				$this->tweet['attachments']['media_keys'][ $media_key_index ],
				array_column($this->included_media, 'media_key')
			);

			if ($media_index !== false) {
				$media = [
					'media_url_https' => !empty($this->included_media[ $media_index ]['url'])
						? $this->included_media[ $media_index ]['url']
						: $this->included_media[ $media_index ]['preview_image_url'],
					'type'            => $this->included_media[ $media_index ]['type'],
				];

				if (isset($new_media['type']) && $new_media['type'] === 'video') {
					$media['video_info'] = [
						'variants' => $this->included_media[ $media_index ]['variants'],
					];
				}

				$media_array[] = $media;
			}
		}

		return $media_array;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit