AlkantarClanX12

Your IP : 18.117.71.239


Current Path : /home/thanudqk/128shen.com/wp-content/plugins/embedpress/EmbedPress/Providers/
Upload File :
Current File : /home/thanudqk/128shen.com/wp-content/plugins/embedpress/EmbedPress/Providers/X.php

<?php

namespace EmbedPress\Providers;

use Embera\Provider\ProviderAdapter;
use Embera\Provider\ProviderInterface;
use Embera\Url;

(defined('ABSPATH') && defined('EMBEDPRESS_IS_LOADED')) or die("No direct script access allowed.");

/**
 * Entity responsible to support Wrapper embeds.
 *
 * @package     EmbedPress
 * @subpackage  EmbedPress/Providers
 * @author      EmbedPress <help@embedpress.com>
 * @copyright   Copyright (C) 2023 WPDeveloper. All rights reserved.
 * @license     GPLv3 or later
 * @since       1.0.0
 */
class X extends ProviderAdapter implements ProviderInterface
{
    /** inline {@inheritdoc} */
    protected $endpoint = 'https://publish.x.com/oembed?format=json';

    /** inline {@inheritdoc} */
    protected static $hosts = [
        'x.com',
    ];

    /** inline {@inheritdoc} */
    protected $allowedParams = [
        'maxwidth', 'maxheight', 'hide_media', 'hide_thread', 'omit_script', 'align',
        'related', 'lang', 'theme', 'link_color', 'widget_type', 'dnt'
    ];

    /** inline {@inheritdoc} */
    protected $httpsSupport = true;

    /** inline {@inheritdoc} */
    protected $responsiveSupport = true;

    /** inline {@inheritdoc} */
    public function validateUrl(Url $url)
    {
        return (bool) (preg_match('~x\.com/(?:[^/]+)/(?:status|moments)/(?:[0-9]+)~i', (string) $url));
    }

    /** inline {@inheritdoc} */
    public function normalizeUrl(Url $url)
    {
        $url->convertToHttps();
        $url->removeQueryString();
        $url->removeLastSlash();

        return $url;
    }

}