1<?php
2class DestinationFile extends Destination {
3  var $_link_text;
4
5  function DestinationFile($filename, $link_text = null) {
6    $this->Destination($filename);
7
8    $this->_link_text = $link_text;
9  }
10
11  function process($tmp_filename, $content_type) {
12    $dest_filename = OUTPUT_FILE_DIRECTORY.$this->filename_escape($this->get_filename()).".".$content_type->default_extension;
13
14    copy($tmp_filename, $dest_filename);
15
16    $text = $this->_link_text;
17    $text = preg_replace('/%link%/', 'file://'.$dest_filename, $text);
18    $text = preg_replace('/%name%/', $this->get_filename(), $text);
19    print $text;
20  }
21}
22?>