Contao\ContentDownload::generate PHP Метод

generate() публичный Метод

Return if the file does not exist
public generate ( ) : string
Результат string
    public function generate()
    {
        // Return if there is no file
        if ($this->singleSRC == '') {
            return '';
        }
        $objFile = \FilesModel::findByUuid($this->singleSRC);
        if ($objFile === null) {
            return '';
        }
        $allowedDownload = \StringUtil::trimsplit(',', strtolower(\Config::get('allowedDownload')));
        // Return if the file type is not allowed
        if (!in_array($objFile->extension, $allowedDownload)) {
            return '';
        }
        $file = \Input::get('file', true);
        // Send the file to the browser and do not send a 404 header (see #4632)
        if ($file != '' && $file == $objFile->path) {
            \Controller::sendFileToBrowser($file);
        }
        $this->singleSRC = $objFile->path;
        return parent::generate();
    }
ContentDownload