PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 4.3.13
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v4.3.13
6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 3.6.66 All 195 releases
fluentform / app / Modules / CLI / Commands.php

Commands.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 4.3.13, at app/Modules/CLI/Commands.php

107 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentForm\App\Modules\CLI;
4
5
6 class Commands
7 {
8 public function stats($args, $assoc_args)
9 {
10 $overallStats = [
11 [
12 'title' => __('All Forms', 'fluentform'),
13 'count' => wpFluent()->table('fluentform_forms')->count(),
14 ],
15 [
16 'title' => __('All Submissions', 'fluentform'),
17 'count' => wpFluent()->table('fluentform_submissions')->count(),
18 ],
19 [
20 'title' => __('Unread Submissions', 'fluentform'),
21 'count' => wpFluent()->table('fluentform_submissions')
22 ->where('status', 'unread')
23 ->count(),
24 ]
25 ];
26
27 $format = \WP_CLI\Utils\get_flag_value($assoc_args, 'format', 'table');
28
29 \WP_CLI\Utils\format_items(
30 $format,
31 $overallStats,
32 ['title', 'count']
33 );
34 }
35
36 public function activate_license($args, $assoc_args)
37 {
38 if (!defined('FLUENTFORMPRO')) {
39 \WP_CLI::line('Fluent Forms pro is not available');
40 return;
41 }
42
43 if (empty($assoc_args['key'])) {
44 \WP_CLI::line('use --key=LICENSE_KEY to activate the license');
45 return;
46 }
47
48 $licenseKey = trim(sanitize_text_field($assoc_args['key']));
49
50 if (!function_exists('fluentFormProActivateLicense')) {
51 \WP_CLI::line('Sorry, fluent forms pro plugin is not up to date');
52 return;
53 }
54
55 \WP_CLI::line('Validating License, Please wait');
56
57 $response = fluentFormProActivateLicense($licenseKey);
58
59
60 if (is_wp_error($response)) {
61 \WP_CLI::error($response->get_error_message());
62 return;
63 }
64
65 \WP_CLI::success('Your license key has been successfully updated');
66
67 \WP_CLI::line('Your License Status: ' . $response['status']);
68 \WP_CLI::line('Expire Date: ' . $response['response']->expires);
69 return;
70 }
71
72 public function license_status()
73 {
74
75 if (!defined('FLUENTFORMPRO')) {
76 \WP_CLI::line('Fluent Forms pro is not available');
77 return;
78 }
79
80 $instance = \FluentFormAddOnChecker::getInstance();
81
82 if (!$instance) {
83 \WP_CLI::line('FluentCRM Pro is not initiated');
84 return;
85 }
86
87 \WP_CLI::line('Fetching License details, Please wait');
88
89 $response = $instance->getRemoteLicense();
90
91 if (is_wp_error($response)) {
92 \WP_CLI::error($response->get_error_message());
93 return;
94 }
95
96 if (!$response) {
97 \WP_CLI::error('License key has not been set!');
98 return;
99 }
100
101
102 \WP_CLI::line('Your License Status: ' . $response->license);
103 \WP_CLI::line('Expires: ' . $response->expires);
104 return;
105 }
106 }
107