/** * Export meta data used by templates. * @return array */ public function meta() { if (!is_array($this->_meta)) { $pot = $po = array(); // get POT files for all domains, fixing incorrect PO usage foreach ($this->get_domains() as $domain) { $path = $this->get_pot($domain) and $pot[] = compact('domain', 'path'); } // get progress and locale for each PO file foreach ($this->po as $domain => $locales) { foreach ($locales as $code => $path) { try { unset($headers); $export = LocoAdmin::parse_po_with_headers($path, $headers); $po[] = array('path' => $path, 'domain' => $domain, 'name' => trim(str_replace(array('.po', '.mo', $domain), array('', '', ''), basename($path)), '-_'), 'stats' => loco_po_stats($export), 'length' => count($export), 'locale' => loco_locale_resolve($code), 'projid' => trim($headers->{'project-id-version'})); } catch (Exception $Ex) { continue; } } } $this->_meta = compact('po', 'pot') + array('name' => $this->get_name(), 'root' => $this->get_root(), 'domain' => $this->get_domain()); } return $this->_meta; }