1 | <?php |
||
12 | abstract class Stencil_Abstract_Installable implements Stencil_Installable_Interface { |
||
13 | /** |
||
14 | * Slug of this module. |
||
15 | * |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $slug; |
||
19 | |||
20 | /** |
||
21 | * Readable name. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $name; |
||
26 | |||
27 | /** |
||
28 | * Version of this module. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $version = '0.0.0'; |
||
33 | |||
34 | /** |
||
35 | * Stencil_Installable constructor. |
||
36 | * |
||
37 | * @param string $slug Slug of the module. |
||
38 | * @param string $name Name of this module. |
||
39 | */ |
||
40 | public function __construct( $slug, $name ) { |
||
44 | |||
45 | /** |
||
46 | * Get slug name. |
||
47 | * |
||
48 | * @return string |
||
49 | */ |
||
50 | public function get_slug() { |
||
53 | |||
54 | /** |
||
55 | * Is this installable installed. |
||
56 | * |
||
57 | * @return bool |
||
58 | */ |
||
59 | public function is_installed() { |
||
62 | |||
63 | /** |
||
64 | * Check if there is an upgrade available |
||
65 | * |
||
66 | * @return bool|mixed |
||
67 | */ |
||
68 | public function has_upgrade() { |
||
71 | |||
72 | /** |
||
73 | * Do all requirements pass so it is usable. |
||
74 | * |
||
75 | * @return bool|array TRUE if passed, array of errors if failed. |
||
76 | */ |
||
77 | public function passed_requirements() { |
||
80 | |||
81 | /** |
||
82 | * Get the name. |
||
83 | * |
||
84 | * @return string |
||
85 | */ |
||
86 | public function __toString() { |
||
89 | |||
90 | /** |
||
91 | * Remove/uninstall |
||
92 | * |
||
93 | * @return bool|WP_Error |
||
94 | */ |
||
95 | public function remove() { |
||
132 | |||
133 | /** |
||
134 | * Install |
||
135 | * |
||
136 | * @param bool $upgrading Installing or upgrading. |
||
137 | * |
||
138 | * @return bool|WP_Error True on succes, WP_Error on failure |
||
139 | */ |
||
140 | public function install( $upgrading = false ) { |
||
240 | |||
241 | /** |
||
242 | * Upgrade |
||
243 | * |
||
244 | * @return bool |
||
245 | * @throws Exception When an upgrade is already in progress for this package. |
||
246 | */ |
||
247 | public function upgrade() { |
||
250 | |||
251 | /** |
||
252 | * Cancel installer. |
||
253 | * |
||
254 | * @param WP_Upgrader_Skin $skin Skin to set message on. |
||
255 | * @param WP_Error|string $error Error to display. |
||
256 | */ |
||
257 | protected function cancel_installer( $skin, $error ) { |
||
262 | } |
||
263 |