-
Notifications
You must be signed in to change notification settings - Fork 122
/
h5peditor-storage.interface.php
92 lines (83 loc) · 3.05 KB
/
h5peditor-storage.interface.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
* A defined interface for the editor to communicate with the database of the
* web system.
*/
interface H5peditorStorage {
/**
* Load language file(JSON) from database.
* This is used to translate the editor fields(title, description etc.)
*
* @param string $name The machine readable name of the library(content type)
* @param int $major Major part of version number
* @param int $minor Minor part of version number
* @param string $lang Language code
* @return string Translation in JSON format
*/
public function getLanguage($machineName, $majorVersion, $minorVersion, $language);
/**
* Load a list of available language codes from the database.
*
* @param string $machineName The machine readable name of the library(content type)
* @param int $majorVersion Major part of version number
* @param int $minorVersion Minor part of version number
* @return array List of possible language codes
*/
public function getAvailableLanguages($machineName, $majorVersion, $minorVersion);
/**
* "Callback" for mark the given file as a permanent file.
* Used when saving content that has new uploaded files.
*
* @param int $fileId
*/
public function keepFile($fileId);
/**
* Decides which content types the editor should have.
*
* Two usecases:
* 1. No input, will list all the available content types.
* 2. Libraries supported are specified, load additional data and verify
* that the content types are available. Used by e.g. the Presentation Tool
* Editor that already knows which content types are supported in its
* slides.
*
* @param array $libraries List of library names + version to load info for
* @return array List of all libraries loaded
*/
public function getLibraries($libraries = NULL);
/**
* Alter styles and scripts
*
* @param array $files
* List of files as objects with path and version as properties
* @param array $libraries
* List of libraries indexed by machineName with objects as values. The objects
* have majorVersion and minorVersion as properties.
*/
public function alterLibraryFiles(&$files, $libraries);
/**
* Saves a file or moves it temporarily. This is often necessary in order to
* validate and store uploaded or fetched H5Ps.
*
* @param string $data Uri of data that should be saved as a temporary file
* @param boolean $move_file Can be set to TRUE to move the data instead of saving it
*
* @return bool|object Returns false if saving failed or the path to the file
* if saving succeeded
*/
public static function saveFileTemporarily($data, $move_file);
/**
* Marks a file for later cleanup, useful when files are not instantly cleaned
* up. E.g. for files that are uploaded through the editor.
*
* @param H5peditorFile
* @param $content_id
*/
public static function markFileForCleanup($file, $content_id);
/**
* Clean up temporary files
*
* @param string $filePath Path to file or directory
*/
public static function removeTemporarilySavedFiles($filePath);
}