Пример #1
0
  /**
  *
  * @return int PARSER_FORBID_PARSING
  * @access protected
  */
  function pre_parse()
  {
    global $tag_dictionary;
    if (! array_key_exists('file', $this->attributes) ||
        empty($this->attributes['file']))
    {
      error('MISSINGREQUIREATTRIBUTE', __FILE__ . ' : ' . __LINE__ . ' : ' .  __FUNCTION__,
        array('tag' => $this->tag,
              'attribute' => 'file',
              'file' => $this->source_file,
              'line' => $this->starting_line_no));
    }
    $file = $this->attributes['file'];

    if (!$this->resolved_source_file = resolve_template_source_file_name($file))
    {
      error('MISSINGFILE', __FILE__ . ' : ' . __LINE__ . ' : ' .  __FUNCTION__,
        array('tag' => $this->tag,
              'srcfile' => $file,
              'file' => $this->source_file,
              'line' => $this->starting_line_no));
    }

    if (array_key_exists('literal', $this->attributes))
    {
      $literal_component =& new text_node(read_template_file($this->resolved_source_file));
      $this->add_child($literal_component);
    }
    else
    {
      $sfp =& new source_file_parser($this->resolved_source_file, $tag_dictionary);
      $sfp->parse($this);
    }
    return PARSER_FORBID_PARSING;
  }
 /**
  * Provide local method of same name to help with Unit testing
  *
  * @param string $ path and file of source template
  * @return string raw text from template file
  * @access private
  */
 function read_template_file($sourcefile)
 {
     return read_template_file($sourcefile);
 }