1 | <?php namespace EmailLog\Addon; |
||
21 | class Addon { |
||
22 | |||
23 | private $name; |
||
24 | private $version; |
||
25 | private $thumbnail; |
||
26 | private $description; |
||
27 | private $link; |
||
28 | private $slug; |
||
29 | private $file; |
||
30 | private $author; |
||
31 | |||
32 | protected $email_log; |
||
33 | protected $license; |
||
34 | |||
35 | /** |
||
36 | * Construct Addon object from data array. |
||
37 | * |
||
38 | * @param array $data Data array. |
||
39 | * @param \EmailLog\Addon\License\AddonLicense|null $license Add-on License. |
||
40 | * @param \EmailLog\Core\EmailLog|null $email_log Email Log instance. |
||
41 | */ |
||
42 | public function __construct( $data, $license = null, $email_log = null ) { |
||
57 | |||
58 | /** |
||
59 | * Render the add-on in Addon list page. |
||
60 | */ |
||
61 | public function render() { |
||
79 | |||
80 | /** |
||
81 | * Have a magic getter instead of having individual getters. |
||
82 | * |
||
83 | * @param string $property Property. |
||
84 | * |
||
85 | * @return string Value for the property. |
||
86 | */ |
||
87 | public function __get( $property ) { |
||
94 | |||
95 | /** |
||
96 | * Get Add-on License object. |
||
97 | * |
||
98 | * @return \EmailLog\Addon\License\AddonLicense License object. |
||
99 | */ |
||
100 | public function get_license() { |
||
103 | |||
104 | /** |
||
105 | * Get action links for add-ons. |
||
106 | */ |
||
107 | protected function print_actions() { |
||
122 | |||
123 | /** |
||
124 | * Print actions that are available when the license is valid. |
||
125 | */ |
||
126 | protected function print_valid_actions() { |
||
148 | |||
149 | /** |
||
150 | * Return the JavaScript that shows the message when the Download button is clicked. |
||
151 | * |
||
152 | * @since 2.2.4 |
||
153 | * |
||
154 | * @return string JavaScript. |
||
155 | */ |
||
156 | protected function get_download_button_js() { |
||
163 | |||
164 | /** |
||
165 | * Print actions that are available when the license is not valid. |
||
166 | */ |
||
167 | protected function print_invalid_actions() { |
||
180 | |||
181 | /** |
||
182 | * Render Individual license form. |
||
183 | */ |
||
184 | protected function render_individual_license() { |
||
228 | |||
229 | /** |
||
230 | * Is the add-on installed? |
||
231 | * |
||
232 | * @return bool True, if installed. False otherwise. |
||
233 | */ |
||
234 | public function is_installed() { |
||
239 | |||
240 | /** |
||
241 | * Get the version of the add-on. |
||
242 | * If the add-on is installed then it returns the installed version, |
||
243 | * otherwise returns the latest add-on version from server. |
||
244 | * |
||
245 | * @return string Add-on version. |
||
246 | */ |
||
247 | public function get_version() { |
||
256 | |||
257 | /** |
||
258 | * Is the add-on active? |
||
259 | * |
||
260 | * @return bool True if the add-on is active, False otherwise. |
||
261 | */ |
||
262 | public function is_active() { |
||
265 | |||
266 | /** |
||
267 | * Get the activate url for the add-on. |
||
268 | * |
||
269 | * @return string Activate url with nonce. |
||
270 | */ |
||
271 | protected function get_activate_url() { |
||
274 | |||
275 | /** |
||
276 | * Get the install url for the add-on. |
||
277 | * |
||
278 | * @return string Install url with nonce. |
||
279 | */ |
||
280 | protected function get_install_url() { |
||
283 | |||
284 | /** |
||
285 | * Get the download url for add-on. |
||
286 | * |
||
287 | * @return string Download url for add-on. |
||
288 | */ |
||
289 | public function get_download_url() { |
||
298 | |||
299 | /** |
||
300 | * Is there a valid bundle license? |
||
301 | * |
||
302 | * @return bool True if valid, False otherwise. |
||
303 | */ |
||
304 | protected function has_valid_bundle_license() { |
||
313 | |||
314 | /** |
||
315 | * Is the license of this add-on valid? |
||
316 | * |
||
317 | * @return bool True if valid, False otherwise. |
||
318 | */ |
||
319 | protected function has_valid_addon_license() { |
||
322 | |||
323 | /** |
||
324 | * Get license key if the add-on has a valid license. |
||
325 | * |
||
326 | * @return string|null License key if found, null otherwise. |
||
327 | */ |
||
328 | public function get_addon_license_key() { |
||
331 | |||
332 | /** |
||
333 | * Parse and store add-on data from data array. |
||
334 | * |
||
335 | * @param array $data Data array. |
||
336 | */ |
||
337 | protected function parse_data( $data ) { |
||
347 | } |
||
348 |