function getData() { if (!isset($this->data) && $this->filepath) { $this->data = YamlDataParser::load($this->filepath); } // TODO: If there was a parsing error, attempt to try the next // language in the list of requested languages return $this->data; }
static function getFileTypes() { static $filetypes; if (!isset($filetypes)) { $filetypes = YamlDataParser::load(INCLUDE_DIR . '/config/filetype.yaml'); } return $filetypes; }
/** * Load the template from the initial_data directory. The format of the * file should be free flow text. The first line is the subject and the * rest of the file is the body. */ function fromInitialData($name, $group = null) { $templ = new EmailTemplate(0, $group); $lang = $group ? $group->getLanguage() : 'en_US'; $info = YamlDataParser::load(I18N_DIR . "{$lang}/templates/{$name}.yaml"); if (isset($info['subject']) && isset($info['body'])) { $templ->ht = $info; return $templ; } raise_error("{$lang}/templates/{$name}.yaml: " . 'Email templates must define both "subject" and "body" parts of the template', 'InitialDataError'); return false; }