PluginProbe
UpdraftPlus: WP Backup & Migration Plugin / 1.13.6
UpdraftPlus: WP Backup & Migration Plugin v1.13.6
1.26.7 1.26.6 1.26.5 1.26.4 1.26.3 1.9.19 1.9.25 1.9.26 1.9.30 1.9.31 1.9.32 1.9.4 1.9.40 1.9.41 1.9.42 1.9.43 1.9.44 1.9.45 1.9.46 1.9.5 1.9.50 1.9.51 1.9.60 1.9.62 1.9.63 All 371 releases
updraftplus / methods / template.php

template.php in UpdraftPlus: WP Backup & Migration Plugin 1.13.6, at methods/template.php

113 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * This is a bare-bones to get you started with developing an access method. The methods provided below are all ones you will want to use (though note that the provided email.php method is an
4 * example of truly bare-bones for a method that cannot delete or download and has no configuration).
5 *
6 * Read the existing methods for help. There is no hard-and-fast need to put all your code in this file; it is just for increasing convenience and maintainability; there are no bonus points for 100% elegance. If you need access to some part of WordPress that you can only reach through the main plugin file (updraftplus.php), then go right ahead and patch that.
7 *
8 * Some handy tips:
9 * - Search-and-replace "template" for the name of your access method
10 * - You can also add the methods config_print_javascript_onready and credentials_test if you like
11 * - Name your file accordingly (it is now template.php)
12 * - Add the method to the array $backup_methods in updraftplus.php when ready
13 * - Use the constant UPDRAFTPLUS_DIR to reach Updraft's plugin directory
14 * - Call $updraftplus->log("my log message") to log things, which greatly helps debugging
15 * - UpdraftPlus is licenced under the GPLv3 or later. In order to combine your backup method with UpdraftPlus, you will need to licence to anyone and everyone that you distribute it to in a compatible way.
16 */
17 if (!defined('UPDRAFTPLUS_DIR')) die('No direct access allowed.');
18
19 if (!class_exists('UpdraftPlus_BackupModule')) require_once(UPDRAFTPLUS_DIR.'/methods/backup-module.php');
20
21 class UpdraftPlus_BackupModule_template extends UpdraftPlus_BackupModule {
22
23 /**
24 * backup method: takes an array, and shovels them off to the cloud storage
25 *
26 * @param Array $backup_array Array of files (basenames) to sent to remote storage
27 * @return Mixed - (boolean)false to indicate failure; otherwise, something to be passed back when deleting files
28 */
29 public function backup($backup_array) {
30
31 global $updraftplus;
32
33 // foreach ($backup_array as $file) {
34
35 // Do our uploading stuff...
36
37 // If successful, then you must do this:
38 // $updraftplus->uploaded_file($file);
39
40 // }
41
42 }
43
44 /**
45 * This function list the files
46 *
47 * @param string $match a substring to require (tested via strpos() !== false)
48 * @return array
49 */
50 public function listfiles($match = 'backup_') {
51 // This function needs to return an array of arrays. The keys for the sub-arrays are name (a path-less filename, i.e. a basename), (optional)size, and should be a list of matching files from the storage backend. A WP_Error object can also be returned; and the error code should be no_settings if that is relevant.
52 return array();
53 }
54
55 /**
56 * delete method: takes an array of file names (base name) or a single string, and removes them from the cloud storage
57 *
58 * @param string $files The specific files
59 * @param mixed $data Anything passed back from self::backup()
60 * @param array $sizeinfo Size information
61 * @return Boolean - whether the operation succeeded or not
62 */
63 public function delete($files, $data = false, $sizeinfo = array()) {
64
65 global $updraftplus;
66
67 if (is_string($files)) $files = array($files);
68
69 }
70
71 /**
72 * download method: takes a file name (base name), and brings it back from the cloud storage into Updraft's directory
73 * You can register errors with $updraftplus->log("my error message", 'error')
74 *
75 * @param string $file The specific file to be downloaded from the Cloud Storage
76 */
77 public function download($file) {
78
79 global $updraftplus;
80
81 }
82
83 public function get_supported_features() {
84 // This options format is handled via only accessing options via $this->get_options()
85 return array('multi_options', 'config_templates');
86 }
87
88 /**
89 * Get the configuration template, in Handlebars format.
90 * Note that logging is not available from this context; it will do nothing.
91 *
92 * @return String - the template, ready for substitutions to be carried out
93 */
94 public function get_configuration_template() {
95
96 ob_start();
97
98 $classes = $this->get_css_classes();
99
100 ?>
101 <tr class="updraftplusmethod <?php echo $classes;?>">
102 <th>My Method:</th>
103 <td>
104
105 </td>
106 </tr>
107
108 <?php
109
110 return ob_get_clean();
111 }
112 }
113