Ejemplo n.º 1
0
 /**
  * Check if a record has an empty value for this attribute.
  *
  * If the record only contains tags or spaces, we consider it empty. We exclude the div
  * tag, since it is often used as (for instance) a placeholder for script results.
  *
  * @param array $record The record that holds this attribute's value.
  *
  * @return bool
  */
 public function isEmpty($record)
 {
     $record[$this->fieldName()] = trim(strip_tags($record[$this->fieldName()], '<div>'));
     return parent::isEmpty($record);
 }
Ejemplo n.º 2
0
 /**
  * Constructor.
  *
  * @param string $name Name of the attribute
  * @param int $flags Flags for this attribute
  * @param string $filename The name of the file to read/write.
  *                         Advanced use: This may be a template containing
  *                         fields from your class, for example:
  *                         "somedir/textfile_[id].txt". If a record has id '9',
  *                         this will read/write a file named
  *                         somedir/textfile_9.txt. Watch out when using fields
  *                         that can change; the attribute won't remove the old
  *                         files.
  */
 public function __construct($name, $flags = 0, $filename)
 {
     $this->m_filename = $filename;
     parent::__construct($name, $flags);
 }