<commit_before><?
	defined('C5_EXECUTE') or die("Access Denied.");
	require_once(DIR_FILES_BLOCK_TYPES_CORE . '/library_file/controller.php');
	
	class FileBlockController extends BlockController {

		protected $btInterfaceWidth = 300;
		protected $btCacheBlockRecord = true;
		protected $btCacheBlockOutput = true;
		protected $btCacheBlockOutputOnPost = true;
		protected $btCacheBlockOutputForRegisteredUsers = true;
		protected $btInterfaceHeight = 250;
		protected $btTable = 'btContentFile';
		
		protected $btExportFileColumns = array('fID');
		
		/** 
		 * Used for localization. If we want to localize the name/description we have to include this
		 */
		public function getBlockTypeDescription() {
			return t("Link to files stored in the asset library.");
		}
		
		public function getBlockTypeName() {
			return t("File");
		}

		public function getJavaScriptStrings() {
			return array('file-required' => t('You must select a file.'));	
		}
		
		public function validate($args) {
			$e = Loader::helper('validation/error');
			if ($args['fID'] < 1) {
				$e->add(t('You must select a file.'));
			}
			if (trim($args['fileLinkText']) == '') {
				$e->add(t('You must give your file a link.'));
			}
			return $e;
		}
		
		function getFileID() {return $this->fID;}
		
		function getFileObject() {
			return File::getByID($this->fID);
		}
		
		function getLinkText() {
			if ($this->fileLinkText) {
				return $this->fileLinkText;
			} else {
				$f = $this->getFileObject();
				return $f->getTitle();
			}
		}<commit_msg>made the file block's file searchable (by title and description)<commit_after><?
	defined('C5_EXECUTE') or die("Access Denied.");
	require_once(DIR_FILES_BLOCK_TYPES_CORE . '/library_file/controller.php');
	
	class FileBlockController extends BlockController {

		protected $btInterfaceWidth = 300;
		protected $btCacheBlockRecord = true;
		protected $btCacheBlockOutput = true;
		protected $btCacheBlockOutputOnPost = true;
		protected $btCacheBlockOutputForRegisteredUsers = true;
		protected $btInterfaceHeight = 250;
		protected $btTable = 'btContentFile';
		
		protected $btExportFileColumns = array('fID');
		
		/** 
		 * Used for localization. If we want to localize the name/description we have to include this
		 */
		public function getBlockTypeDescription() {
			return t("Link to files stored in the asset library.");
		}
		
		public function getBlockTypeName() {
			return t("File");
		}

		public function getJavaScriptStrings() {
			return array('file-required' => t('You must select a file.'));	
		}
		
		public function getSearchableContent(){
			$f = $this->getFileObject();
			return $f->getTitle().' '.$f->getDescription();
		}
		
		public function validate($args) {
			$e = Loader::helper('validation/error');
			if ($args['fID'] < 1) {
				$e->add(t('You must select a file.'));
			}
			if (trim($args['fileLinkText']) == '') {
				$e->add(t('You must give your file a link.'));
			}
			return $e;
		}
		
		function getFileID() {return $this->fID;}
		
		function getFileObject() {
			return File::getByID($this->fID);
		}
		
		function getLinkText() {
			if ($this->fileLinkText) {
				return $this->fileLinkText;
			} else {
				$f = $this->getFileObject();
				return $f->getTitle();
			}
		}
{'fraction_non_alphanumeric': 0.14096645121575868, 'fraction_numerical': 0.0049245921822099106, 'mean_word_length': 3.793510324483776, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7045371', 'n_tokens_mistral': 1197, 'n_tokens_neox': 984, 'n_words': 257}