-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextension.driver.php
38 lines (30 loc) · 990 Bytes
/
extension.driver.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
Final Class extension_Downloadable_Page_Type extends Extension{
public function about(){
return array('name' => 'Downloadable Page Type',
'version' => '0.1',
'release-date' => '2009-06-30',
'author' => array('name' => 'Andrew Shooner',
'website' => 'http://www.andrewshooner.com',
'email' => '[email protected]')
);
}
public function getSubscribedDelegates(){
return array(
array(
'page' => '/frontend/',
'delegate' => 'FrontendOutputPreGenerate',
'callback' => 'setContentDisposition'
),
);
}
public function setContentDisposition(array $context=NULL){
$page_data = Frontend::Page()->pageData();
foreach($page_data['type'] as $type){
if(substr($type, 0, 1) == "." ){
$FileName = $page_data['handle'];
Frontend::Page()->addHeaderToPage('Content-Disposition', 'attachment; filename=' . $FileName . $type);
}
}
}
}