/** * Constructor * * Checks for valid parameters, and initializes proper options. * * @param string $enc_from character set of files (present) * @param string $enc_to output character set * @param integer $comp_level * @param array $incpath elements of include path * * @access public */ public function __construct(&$enc_from = null, &$enc_to = null, &$comp_level = null, &$email = null, &$incPath = null) { if (is_null($incPath)) { $this->_incPath = array(ROOT, Path::join(ROOT, 'inc')); } else { $this->_incPath = $incPath; } if (!is_null($email) && Strings::email($email)) { $this->_email = $email; } if (is_null($comp_level)) { $comp_level = self::COMP_LEVEL; } if (is_null($enc_from)) { $enc_from = self::ENC_FROM; } if (is_null($enc_to)) { $enc_to = self::ENC_TO; } if (defined('DEBUG') && DEBUG) { $this->_debug = true; } $ob_start_opts = array(); if ($comp_level > 0) { $comp = $this->_initCompress($comp_level); if ($comp !== false) { $ob_start_opts[] = $comp; } } if ($enc_from !== $enc_to) { $enc = $this->_initEncoding($enc_from, $enc_to); if ($enc !== false) { $ob_start_opts[] = $enc; } } if (count($ob_start_opts) > 0) { ob_start($ob_start_opts); $this->_initialized = true; } else { $this->_initialized = false; } $this->_initPhpSettings(); }
/** * Checks for correctness of email address * * @param string $data author's email address * * @return boolean * @throws CESyntaxError if incorrect type (@see $this->isType()) * * @access protected */ protected function set_author_mail($data) { if (is_null($data)) { unset($this->author_mail); return true; } $this->isType('author_mail', $data); $data = trim($data); if ('' != $data && !Strings::email($data)) { $this->errorSet('Incorrect email address.'); return false; } else { $this->properties['author_mail'][0] = $data; return true; } }