Вход Регистрация
Файл: sngine-v2.8/Script/includes/libs/Embed/Adapters/N500px.php
Строк: 34
<?php

namespace EmbedAdapters;

use 
EmbedHttpResponse;
use 
EmbedUtils;

/**
 * Adapter get embed code from 500px.com.
 */
class N500px extends Webpage
{
    
/**
     * {@inheritdoc}
     */
    
public static function check(Response $response)
    {
        return 
$response->isValid() && $response->getUrl()->match([
            
'500px.com/photo/*',
        ]);
    }

    
/**
     * {@inheritdoc}
     */
    
public function getCode()
    {
        
$url $this->getResponse()->getUrl();

        if (
is_numeric($url->getDirectoryPosition(1))) {
            return 
Utils::iframe($url->withDirectoryPosition(2'embed.html'), $this->width$this->height);
        }
    }

    
/**
     * {@inheritdoc}
     */
    
public function getWidth()
    {
        if (
is_numeric($this->getResponse()->getUrl()->getDirectoryPosition(1))) {
            return 
$this->imageWidth;
        }
    }

    
/**
     * {@inheritdoc}
     */
    
public function getHeight()
    {
        if (
is_numeric($this->getResponse()->getUrl()->getDirectoryPosition(1))) {
            return 
$this->imageHeight;
        }
    }
}
Онлайн: 0
Реклама