Commit 20a2d86d authored by Adrian Schlegel's avatar Adrian Schlegel Committed by Penny Leach
Browse files

Set the mimetype of a file as the value of the 'type' attribute for

enclosures in a leap2a export.
Signed-off-by: default avatarAdrian Schlegel <>
parent a6f269aa
......@@ -57,7 +57,7 @@ class LeapExportElementFile extends LeapExportElement {
public function add_attachments() {
$this->filename = $this->exporter->add_attachment($this->artefact->get_path(), $this->artefact->get('title'));
$this->add_enclosure_link($this->filename, $this->get_content_type());
public function get_content_type() {
......@@ -820,12 +820,15 @@ class LeapExportElement {
* {@link add_attachment} method on the exporter object.
* @param string $filename the relative path of the file (NOT including the filesdir)
* @param string $mimetype the (optional) mimetype of the file (according to atom
* spec the type attribute on an enclosure is optional)
public function add_enclosure_link($filename) {
public function add_enclosure_link($filename, $mimetype = '') {
$this->links[$filename] = (object)array(
'id' => $this->exporter->get('filedir') . $filename,
'type' => 'enclosure',
'file' => true
'file' => true,
'mimetype' => $mimetype
{foreach from=$links item=link} <link rel="{$link->type}" href="{$link->id}"{if $link->display_order} leap2:display_order="{$link->display_order}"{/if}/>
{foreach from=$links item=link} <link rel="{$link->type}"{if $link->mimetype != ''} type="{$link->mimetype}"{/if} href="{$link->id}"{if $link->display_order} leap2:display_order="{$link->display_order}"{/if}/>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment