PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / 2.1.2
Fluent Support – Helpdesk & Customer Support Ticket System v2.1.2
2.4.0 2.3.2 2.3.1 2.3.0 2.2.1 2.2.0 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.4.0 1.4.1 1.4.2 1.4.5 1.4.6 1.4.7 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 All 68 releases
fluent-support / app / Services / Integrations / Maintenance.php

Maintenance.php in Fluent Support – Helpdesk & Customer Support Ticket System 2.1.2, at app/Services/Integrations/Maintenance.php

69 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentSupport\App\Services\Integrations;
4
5 use FluentSupport\App\Services\Helper;
6
7 class Maintenance
8 {
9 public function maybeProcessData()
10 {
11 if (!$this->isAllowed() || !$this->timeMatched()) {
12 return false;
13 }
14
15 $response = wp_remote_post($this->getApiUrl(), [
16 'body' => [
17 'payload' => $this->getData()
18 ],
19 'sslverify' => false,
20 'cookies' => []
21 ]);
22
23 if (is_wp_error($response)) {
24 return false;
25 }
26
27 update_option('_fluent_last_m_run', time());
28
29 return true;
30 }
31
32 private function getData()
33 {
34 global $wp_version;
35 return [
36 'plugin_version' => FLUENT_SUPPORT_VERSION,
37 'php_version' => (defined('PHP_VERSION')) ? PHP_VERSION : phpversion(),
38 'wp_version' => $wp_version,
39 'plugins' => (array)get_option('active_plugins'),
40 'site_lang' => get_bloginfo('language'),
41 'site_url' => site_url('/'),
42 'theme' => wp_get_theme()->get('Name'),
43 'admin_email' => get_bloginfo('admin_email'),
44 'site_title' => get_bloginfo('name')
45 ];
46 }
47
48 private function isAllowed()
49 {
50 return apply_filters('fluentsupport_allow_share_essential', Helper::getOption('_share_essential', 'no') == 'yes');
51 }
52
53 private function timeMatched()
54 {
55 $prevValue = get_option('_fluent_last_m_run');
56 if (!$prevValue) {
57 return true;
58 }
59
60 return (time() - $prevValue) > 518400; // 6 days match
61 }
62
63 private function getApiUrl()
64 {
65 return 'https://api.wpmanageninja.com/plugin-maintenance';
66 }
67
68 }
69