<commit_before><?php
class Kwc_Basic_Download_Component extends Kwc_Abstract_Composite_Component
{
    protected $_fileRow;

    public static function getSettings()
    {
        $ret = parent::getSettings();
        $ret['ownModel'] = 'Kwc_Basic_Download_Model';
        $ret['componentName'] = trlKwf('Download');
        $ret['componentIcon'] = new Kwf_Asset('folder_link');
        $ret['showFilesize'] = true;
        $ret['showIcon'] = true;
        $ret['cssClass'] = 'webStandard';
        $ret['flags']['searchContent'] = true;
        $ret['flags']['hasFulltext'] = true;
        $ret['generators']['child']['component']['downloadTag'] = 'Kwc_Basic_DownloadTag_Component';
        return $ret;
    }

    public function getTemplateVars()
    {
        $return = parent::getTemplateVars();

        $fileRow = $this->_getFileRow();
        $parentRow = $fileRow->getParentRow('File');
        if ($this->_getSetting('showFilesize') && $parentRow) {
            $return['filesize'] = $parentRow->getFileSize();
        } else {
            $return['filesize'] = null;
        }
        $return['infotext'] = $this->_getRow()->infotext;
        if ($return['infotext'] == '' && $parentRow)
            $return['infotext'] = $parentRow->filename;

        if ($this->_getSetting('showIcon')) {
            $return['icon'] = $this->getIcon();
        } else {
            $return['icon'] = null;
        }
        return $return;
    }

    private function _getFileRow()
    {
        if (!$this->_fileRow) {
            $this->_fileRow = $this->getData()
                ->getChildComponent('-downloadTag')->
                getComponent()->getFileRow();
        }
        return $this->_fileRow;
    }

    public function getIcon()
    {
        $fileRow = $this->_getFileRow()->getParentRow('File');
        if (!$fileRow) return 'page_white_get';
        return Kwf_Util_FileIcon::getFileIcon($fileRow->extension);
    }

    public function getSearchContent()
    {
        return $this->_getRow()->infotext;
    }

    public function modifyFulltextDocument(Zend_Search_Lucene_Document $doc)
    {
        $fieldName = $this->getData()->componentId;

        $doc->getField('content')->value .= ' '.$this->_getRow()->infotext;
<commit_msg>add extension to Download template vars<commit_after><?php
class Kwc_Basic_Download_Component extends Kwc_Abstract_Composite_Component
{
    protected $_fileRow;

    public static function getSettings()
    {
        $ret = parent::getSettings();
        $ret['ownModel'] = 'Kwc_Basic_Download_Model';
        $ret['componentName'] = trlKwf('Download');
        $ret['componentIcon'] = new Kwf_Asset('folder_link');
        $ret['showFilesize'] = true;
        $ret['showIcon'] = true;
        $ret['cssClass'] = 'webStandard';
        $ret['flags']['searchContent'] = true;
        $ret['flags']['hasFulltext'] = true;
        $ret['generators']['child']['component']['downloadTag'] = 'Kwc_Basic_DownloadTag_Component';
        return $ret;
    }

    public function getTemplateVars()
    {
        $return = parent::getTemplateVars();

        $fileRow = $this->_getFileRow();
        $parentRow = $fileRow->getParentRow('File');
        if ($this->_getSetting('showFilesize') && $parentRow) {
            $return['filesize'] = $parentRow->getFileSize();
        } else {
            $return['filesize'] = null;
        }
        $return['infotext'] = $this->_getRow()->infotext;
        if ($return['infotext'] == '' && $parentRow)
            $return['infotext'] = $parentRow->filename;

        if ($this->_getSetting('showIcon')) {
            $return['icon'] = $this->getIcon();
        } else {
            $return['icon'] = null;
        }
        if ($parentRow) {
            $return['extension'] = $parentRow->extension;
        } else {
            $return['extension'] = null;
        }
        return $return;
    }

    private function _getFileRow()
    {
        if (!$this->_fileRow) {
            $this->_fileRow = $this->getData()
                ->getChildComponent('-downloadTag')->
                getComponent()->getFileRow();
        }
        return $this->_fileRow;
    }

    public function getIcon()
    {
        $fileRow = $this->_getFileRow()->getParentRow('File');
        if (!$fileRow) return 'page_white_get';
        return Kwf_Util_FileIcon::getFileIcon($fileRow->extension);
    }

    public function getSearchContent()
    {
        return $this->_getRow()->infotext;
    }

    public function modifyFulltextDocument(Zend_Search_Lucene_Document $doc)
    {
        $fieldName = $this->getData()->componentId;

        $doc->getField('content')->value .= ' '.$this->_getRow()->infotext;

{'fraction_non_alphanumeric': 0.16559965855740505, 'fraction_numerical': 0.0, 'mean_word_length': 2.566971080669711, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 58, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 13, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7036037', 'n_tokens_mistral': 1378, 'n_tokens_neox': 1363, 'n_words': 216}