-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft.vwm_secure_files.php
65 lines (55 loc) · 1.34 KB
/
ft.vwm_secure_files.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php if ( ! defined('EXT')) { exit('Invalid file request'); }
/**
* VWM Secure Files
*
* @package VWM Secure Files
* @author Victor Michnowicz
* @copyright Copyright (c) 2011 Victor Michnowicz
* @license http://www.apache.org/licenses/LICENSE-2.0.html
* @link http://github.com/vmichnowicz/vwm_secure_files
*/
// -----------------------------------------------------------------------------
/**
* VWM Secure Files fieldtype
*/
class Vwm_secure_files_ft extends EE_Fieldtype {
public $info = array(
'name' => 'VWM Secure Files',
'version' => '0.1'
);
/**
* Constructor
*
* @access public
* @return void
*/
public function __construct()
{
parent::__construct();
// Load model
$this->EE->lang->loadfile('vwm_secure_files');
$this->EE->load->model('vwm_secure_files_m');
}
/**
* Display field in publish field
*
* @access public
* @param string Field text
* @return string
*/
public function display_field($data)
{
/**
* Grab the selected file
* If this is a new entry, there will be no currently selected file
*/
$current_file = $data == '' ? NULL : $data;
$data = array(
'files' => $this->EE->vwm_secure_files_m->all_files(),
'field_name' => $this->field_name,
'current_file' => $current_file
);
return $this->EE->load->view('display_field', $data, TRUE);
}
}
// END CLASS