/**
  * Parses a template and returns any translatable entities
  */
 public static function GetTranslatables($template)
 {
     self::$entities = array();
     // Run the parser and throw away the result
     $parser = new i18nTextCollector_Parser($template);
     if (substr($template, 0, 3) == pack("CCC", 0xef, 0xbb, 0xbf)) {
         $parser->pos = 3;
     }
     $parser->match_TopTemplate();
     return self::$entities;
 }
 /**
  * Extracts translatables from .ss templates (Self referencing)
  *
  * @param string $content The text content of a parsed template-file
  * @param string $fileName The name of a template file when method is used in self-referencing mode
  * @param string $module Module's name or 'themes'
  * @param array $parsedFiles
  * @return array $entities An array of entities representing the extracted template function calls
  */
 public function collectFromTemplate($content, $fileName, $module, &$parsedFiles = array())
 {
     // use parser to extract <%t style translatable entities
     $entities = i18nTextCollector_Parser::GetTranslatables($content);
     // use the old method of getting _t() style translatable entities
     // Collect in actual template
     if (preg_match_all('/(_t\\([^\\)]*?\\))/ms', $content, $matches)) {
         foreach ($matches[1] as $match) {
             $entities = array_merge($entities, $this->collectFromCode($match, $module));
         }
     }
     foreach ($entities as $entity => $spec) {
         unset($entities[$entity]);
         $entities[$this->normalizeEntity($entity, $module)] = $spec;
     }
     ksort($entities);
     return $entities;
 }