Вход Регистрация
Файл: contao-3.5.8/system/modules/core/elements/ContentImage.php
Строк: 45
<?php

/**
 * Contao Open Source CMS
 *
 * Copyright (c) 2005-2016 Leo Feyer
 *
 * @license LGPL-3.0+
 */

namespace Contao;


/**
 * Front end content element "image".
 *
 * @author Leo Feyer <https://github.com/leofeyer>
 */
class ContentImage extends ContentElement
{

    
/**
     * Template
     * @var string
     */
    
protected $strTemplate 'ce_image';


    
/**
     * Return if the image does not exist
     *
     * @return string
     */
    
public function generate()
    {
        if (
$this->singleSRC == '')
        {
            return 
'';
        }

        
$objFile FilesModel::findByUuid($this->singleSRC);

        if (
$objFile === null)
        {
            if (!
Validator::isUuid($this->singleSRC))
            {
                return 
'<p class="error">'.$GLOBALS['TL_LANG']['ERR']['version2format'].'</p>';
            }

            return 
'';
        }

        if (!
is_file(TL_ROOT '/' $objFile->path))
        {
            return 
'';
        }

        
$this->singleSRC $objFile->path;

        return 
parent::generate();
    }


    
/**
     * Generate the content element
     */
    
protected function compile()
    {
        
$this->addImageToTemplate($this->Template$this->arrData);
    }
}
Онлайн: 0
Реклама