@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <div class="et_contact_bottom_container"> |
4 | 4 | <button type="submit" class="glsr-button et_pb_contact_submit et_pb_button"> |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | return [ |
4 | - 'fields' => [ |
|
5 | - 'input' => 'input', |
|
6 | - 'input_checkbox' => 'input', |
|
7 | - 'input_radio' => 'input', |
|
8 | - 'label' => 'et_pb_contact_form_label', |
|
9 | - 'select' => 'et_pb_contact_select input', |
|
10 | - 'textarea' => 'et_pb_contact_message input', |
|
11 | - ], |
|
12 | - 'validation' => [ |
|
13 | - 'field_error_class' => 'et_contact_error', |
|
14 | - 'input_error_class' => 'et_contact_error', |
|
15 | - ], |
|
4 | + 'fields' => [ |
|
5 | + 'input' => 'input', |
|
6 | + 'input_checkbox' => 'input', |
|
7 | + 'input_radio' => 'input', |
|
8 | + 'label' => 'et_pb_contact_form_label', |
|
9 | + 'select' => 'et_pb_contact_select input', |
|
10 | + 'textarea' => 'et_pb_contact_message input', |
|
11 | + ], |
|
12 | + 'validation' => [ |
|
13 | + 'field_error_class' => 'et_contact_error', |
|
14 | + 'input_error_class' => 'et_contact_error', |
|
15 | + ], |
|
16 | 16 | ]; |
@@ -12,163 +12,163 @@ |
||
12 | 12 | |
13 | 13 | class SettingsController extends Controller |
14 | 14 | { |
15 | - /** |
|
16 | - * @param mixed $input |
|
17 | - * @return array |
|
18 | - * @callback register_setting |
|
19 | - */ |
|
20 | - public function callbackRegisterSettings($input) |
|
21 | - { |
|
22 | - $settings = Arr::consolidateArray($input); |
|
23 | - if (1 === count($settings) && array_key_exists('settings', $settings)) { |
|
24 | - $options = array_replace_recursive(glsr(OptionManager::class)->all(), $input); |
|
25 | - $options = $this->sanitizeGeneral($input, $options); |
|
26 | - $options = $this->sanitizeLicenses($input, $options); |
|
27 | - $options = $this->sanitizeSubmissions($input, $options); |
|
28 | - $options = $this->sanitizeTranslations($input, $options); |
|
29 | - $options = apply_filters('site-reviews/settings/callback', $options, $settings); |
|
30 | - if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') { |
|
31 | - glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews')); |
|
32 | - } |
|
33 | - return $options; |
|
34 | - } |
|
35 | - return $input; |
|
36 | - } |
|
15 | + /** |
|
16 | + * @param mixed $input |
|
17 | + * @return array |
|
18 | + * @callback register_setting |
|
19 | + */ |
|
20 | + public function callbackRegisterSettings($input) |
|
21 | + { |
|
22 | + $settings = Arr::consolidateArray($input); |
|
23 | + if (1 === count($settings) && array_key_exists('settings', $settings)) { |
|
24 | + $options = array_replace_recursive(glsr(OptionManager::class)->all(), $input); |
|
25 | + $options = $this->sanitizeGeneral($input, $options); |
|
26 | + $options = $this->sanitizeLicenses($input, $options); |
|
27 | + $options = $this->sanitizeSubmissions($input, $options); |
|
28 | + $options = $this->sanitizeTranslations($input, $options); |
|
29 | + $options = apply_filters('site-reviews/settings/callback', $options, $settings); |
|
30 | + if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') { |
|
31 | + glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews')); |
|
32 | + } |
|
33 | + return $options; |
|
34 | + } |
|
35 | + return $input; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * @return void |
|
40 | - * @action admin_init |
|
41 | - */ |
|
42 | - public function registerSettings() |
|
43 | - { |
|
44 | - register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [ |
|
45 | - 'sanitize_callback' => [$this, 'callbackRegisterSettings'], |
|
46 | - ]); |
|
47 | - } |
|
38 | + /** |
|
39 | + * @return void |
|
40 | + * @action admin_init |
|
41 | + */ |
|
42 | + public function registerSettings() |
|
43 | + { |
|
44 | + register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [ |
|
45 | + 'sanitize_callback' => [$this, 'callbackRegisterSettings'], |
|
46 | + ]); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @return array |
|
51 | - */ |
|
52 | - protected function sanitizeGeneral(array $input, array $options) |
|
53 | - { |
|
54 | - $key = 'settings.general'; |
|
55 | - $inputForm = Arr::get($input, $key); |
|
56 | - if (!$this->hasMultilingualIntegration(Arr::get($inputForm, 'multilingual'))) { |
|
57 | - $options = Arr::set($options, $key.'.multilingual', ''); |
|
58 | - } |
|
59 | - if ('' == trim(Arr::get($inputForm, 'notification_message'))) { |
|
60 | - $defaultValue = Arr::get(glsr()->defaults, $key.'.notification_message'); |
|
61 | - $options = Arr::set($options, $key.'.notification_message', $defaultValue); |
|
62 | - } |
|
63 | - $defaultValue = Arr::get($inputForm, 'notifications', []); |
|
64 | - $options = Arr::set($options, $key.'.notifications', $defaultValue); |
|
65 | - return $options; |
|
66 | - } |
|
49 | + /** |
|
50 | + * @return array |
|
51 | + */ |
|
52 | + protected function sanitizeGeneral(array $input, array $options) |
|
53 | + { |
|
54 | + $key = 'settings.general'; |
|
55 | + $inputForm = Arr::get($input, $key); |
|
56 | + if (!$this->hasMultilingualIntegration(Arr::get($inputForm, 'multilingual'))) { |
|
57 | + $options = Arr::set($options, $key.'.multilingual', ''); |
|
58 | + } |
|
59 | + if ('' == trim(Arr::get($inputForm, 'notification_message'))) { |
|
60 | + $defaultValue = Arr::get(glsr()->defaults, $key.'.notification_message'); |
|
61 | + $options = Arr::set($options, $key.'.notification_message', $defaultValue); |
|
62 | + } |
|
63 | + $defaultValue = Arr::get($inputForm, 'notifications', []); |
|
64 | + $options = Arr::set($options, $key.'.notifications', $defaultValue); |
|
65 | + return $options; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * @return array |
|
70 | - */ |
|
71 | - protected function sanitizeLicenses(array $input, array $options) |
|
72 | - { |
|
73 | - $key = 'settings.licenses'; |
|
74 | - $licenses = Arr::consolidateArray(Arr::get($input, $key)); |
|
75 | - foreach ($licenses as $slug => &$license) { |
|
76 | - if (empty($license)) { |
|
77 | - continue; |
|
78 | - } |
|
79 | - $license = $this->verifyLicense($license, $slug); |
|
80 | - } |
|
81 | - $options = Arr::set($options, $key, $licenses); |
|
82 | - return $options; |
|
83 | - } |
|
68 | + /** |
|
69 | + * @return array |
|
70 | + */ |
|
71 | + protected function sanitizeLicenses(array $input, array $options) |
|
72 | + { |
|
73 | + $key = 'settings.licenses'; |
|
74 | + $licenses = Arr::consolidateArray(Arr::get($input, $key)); |
|
75 | + foreach ($licenses as $slug => &$license) { |
|
76 | + if (empty($license)) { |
|
77 | + continue; |
|
78 | + } |
|
79 | + $license = $this->verifyLicense($license, $slug); |
|
80 | + } |
|
81 | + $options = Arr::set($options, $key, $licenses); |
|
82 | + return $options; |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * @return array |
|
87 | - */ |
|
88 | - protected function sanitizeSubmissions(array $input, array $options) |
|
89 | - { |
|
90 | - $key = 'settings.submissions'; |
|
91 | - $inputForm = Arr::get($input, $key); |
|
92 | - $defaultValue = isset($inputForm['required']) |
|
93 | - ? $inputForm['required'] |
|
94 | - : []; |
|
95 | - $options = Arr::set($options, $key.'.required', $defaultValue); |
|
96 | - return $options; |
|
97 | - } |
|
85 | + /** |
|
86 | + * @return array |
|
87 | + */ |
|
88 | + protected function sanitizeSubmissions(array $input, array $options) |
|
89 | + { |
|
90 | + $key = 'settings.submissions'; |
|
91 | + $inputForm = Arr::get($input, $key); |
|
92 | + $defaultValue = isset($inputForm['required']) |
|
93 | + ? $inputForm['required'] |
|
94 | + : []; |
|
95 | + $options = Arr::set($options, $key.'.required', $defaultValue); |
|
96 | + return $options; |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * @return array |
|
101 | - */ |
|
102 | - protected function sanitizeTranslations(array $input, array $options) |
|
103 | - { |
|
104 | - $key = 'settings.strings'; |
|
105 | - $inputForm = Arr::consolidateArray(Arr::get($input, $key)); |
|
106 | - if (!empty($inputForm)) { |
|
107 | - $options = Arr::set($options, $key, array_values(array_filter($inputForm))); |
|
108 | - $allowedTags = [ |
|
109 | - 'a' => ['class' => [], 'href' => [], 'target' => []], |
|
110 | - 'span' => ['class' => []], |
|
111 | - ]; |
|
112 | - array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) { |
|
113 | - if (isset($string['s2'])) { |
|
114 | - $string['s2'] = wp_kses($string['s2'], $allowedTags); |
|
115 | - } |
|
116 | - if (isset($string['p2'])) { |
|
117 | - $string['p2'] = wp_kses($string['p2'], $allowedTags); |
|
118 | - } |
|
119 | - }); |
|
120 | - } |
|
121 | - return $options; |
|
122 | - } |
|
99 | + /** |
|
100 | + * @return array |
|
101 | + */ |
|
102 | + protected function sanitizeTranslations(array $input, array $options) |
|
103 | + { |
|
104 | + $key = 'settings.strings'; |
|
105 | + $inputForm = Arr::consolidateArray(Arr::get($input, $key)); |
|
106 | + if (!empty($inputForm)) { |
|
107 | + $options = Arr::set($options, $key, array_values(array_filter($inputForm))); |
|
108 | + $allowedTags = [ |
|
109 | + 'a' => ['class' => [], 'href' => [], 'target' => []], |
|
110 | + 'span' => ['class' => []], |
|
111 | + ]; |
|
112 | + array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) { |
|
113 | + if (isset($string['s2'])) { |
|
114 | + $string['s2'] = wp_kses($string['s2'], $allowedTags); |
|
115 | + } |
|
116 | + if (isset($string['p2'])) { |
|
117 | + $string['p2'] = wp_kses($string['p2'], $allowedTags); |
|
118 | + } |
|
119 | + }); |
|
120 | + } |
|
121 | + return $options; |
|
122 | + } |
|
123 | 123 | |
124 | - /** |
|
125 | - * @param string $integrationSlug |
|
126 | - * @return bool |
|
127 | - */ |
|
128 | - protected function hasMultilingualIntegration($integrationSlug) |
|
129 | - { |
|
130 | - $integration = glsr(Multilingual::class)->getIntegration($integrationSlug); |
|
131 | - if (!$integration) { |
|
132 | - return false; |
|
133 | - } |
|
134 | - if (!$integration->isActive()) { |
|
135 | - glsr(Notice::class)->addError(sprintf( |
|
136 | - __('Please install/activate the %s plugin to enable integration.', 'site-reviews'), |
|
137 | - $integration->pluginName |
|
138 | - )); |
|
139 | - return false; |
|
140 | - } elseif (!$integration->isSupported()) { |
|
141 | - glsr(Notice::class)->addError(sprintf( |
|
142 | - __('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'), |
|
143 | - $integration->pluginName, |
|
144 | - $integration->supportedVersion |
|
145 | - )); |
|
146 | - return false; |
|
147 | - } |
|
148 | - return true; |
|
149 | - } |
|
124 | + /** |
|
125 | + * @param string $integrationSlug |
|
126 | + * @return bool |
|
127 | + */ |
|
128 | + protected function hasMultilingualIntegration($integrationSlug) |
|
129 | + { |
|
130 | + $integration = glsr(Multilingual::class)->getIntegration($integrationSlug); |
|
131 | + if (!$integration) { |
|
132 | + return false; |
|
133 | + } |
|
134 | + if (!$integration->isActive()) { |
|
135 | + glsr(Notice::class)->addError(sprintf( |
|
136 | + __('Please install/activate the %s plugin to enable integration.', 'site-reviews'), |
|
137 | + $integration->pluginName |
|
138 | + )); |
|
139 | + return false; |
|
140 | + } elseif (!$integration->isSupported()) { |
|
141 | + glsr(Notice::class)->addError(sprintf( |
|
142 | + __('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'), |
|
143 | + $integration->pluginName, |
|
144 | + $integration->supportedVersion |
|
145 | + )); |
|
146 | + return false; |
|
147 | + } |
|
148 | + return true; |
|
149 | + } |
|
150 | 150 | |
151 | - /** |
|
152 | - * @param string $license |
|
153 | - * @param string $slug |
|
154 | - * @return string |
|
155 | - */ |
|
156 | - protected function verifyLicense($license, $slug) |
|
157 | - { |
|
158 | - try { |
|
159 | - $addon = glsr($slug); |
|
160 | - $updater = new Updater($addon->update_url, $addon->file, [ |
|
161 | - 'license' => $license, |
|
162 | - 'testedTo' => $addon->testedTo, |
|
163 | - ]); |
|
164 | - if (!$updater->isLicenseValid()) { |
|
165 | - throw new Exception('Invalid license: '.$license.' ('.$addon->id.')'); |
|
166 | - } |
|
167 | - } catch (Exception $e) { |
|
168 | - $license = ''; |
|
169 | - glsr_log()->debug($e->getMessage()); |
|
170 | - glsr(Notice::class)->addError(__('A license you entered was invalid.', 'site-reviews')); |
|
171 | - } |
|
172 | - return $license; |
|
173 | - } |
|
151 | + /** |
|
152 | + * @param string $license |
|
153 | + * @param string $slug |
|
154 | + * @return string |
|
155 | + */ |
|
156 | + protected function verifyLicense($license, $slug) |
|
157 | + { |
|
158 | + try { |
|
159 | + $addon = glsr($slug); |
|
160 | + $updater = new Updater($addon->update_url, $addon->file, [ |
|
161 | + 'license' => $license, |
|
162 | + 'testedTo' => $addon->testedTo, |
|
163 | + ]); |
|
164 | + if (!$updater->isLicenseValid()) { |
|
165 | + throw new Exception('Invalid license: '.$license.' ('.$addon->id.')'); |
|
166 | + } |
|
167 | + } catch (Exception $e) { |
|
168 | + $license = ''; |
|
169 | + glsr_log()->debug($e->getMessage()); |
|
170 | + glsr(Notice::class)->addError(__('A license you entered was invalid.', 'site-reviews')); |
|
171 | + } |
|
172 | + return $license; |
|
173 | + } |
|
174 | 174 | } |
@@ -17,18 +17,18 @@ discard block |
||
17 | 17 | * @return array |
18 | 18 | * @callback register_setting |
19 | 19 | */ |
20 | - public function callbackRegisterSettings($input) |
|
20 | + public function callbackRegisterSettings( $input ) |
|
21 | 21 | { |
22 | - $settings = Arr::consolidateArray($input); |
|
23 | - if (1 === count($settings) && array_key_exists('settings', $settings)) { |
|
24 | - $options = array_replace_recursive(glsr(OptionManager::class)->all(), $input); |
|
25 | - $options = $this->sanitizeGeneral($input, $options); |
|
26 | - $options = $this->sanitizeLicenses($input, $options); |
|
27 | - $options = $this->sanitizeSubmissions($input, $options); |
|
28 | - $options = $this->sanitizeTranslations($input, $options); |
|
29 | - $options = apply_filters('site-reviews/settings/callback', $options, $settings); |
|
30 | - if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') { |
|
31 | - glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews')); |
|
22 | + $settings = Arr::consolidateArray( $input ); |
|
23 | + if( 1 === count( $settings ) && array_key_exists( 'settings', $settings ) ) { |
|
24 | + $options = array_replace_recursive( glsr( OptionManager::class )->all(), $input ); |
|
25 | + $options = $this->sanitizeGeneral( $input, $options ); |
|
26 | + $options = $this->sanitizeLicenses( $input, $options ); |
|
27 | + $options = $this->sanitizeSubmissions( $input, $options ); |
|
28 | + $options = $this->sanitizeTranslations( $input, $options ); |
|
29 | + $options = apply_filters( 'site-reviews/settings/callback', $options, $settings ); |
|
30 | + if( filter_input( INPUT_POST, 'option_page' ) == Application::ID.'-settings' ) { |
|
31 | + glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) ); |
|
32 | 32 | } |
33 | 33 | return $options; |
34 | 34 | } |
@@ -41,80 +41,80 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function registerSettings() |
43 | 43 | { |
44 | - register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [ |
|
44 | + register_setting( Application::ID.'-settings', OptionManager::databaseKey(), [ |
|
45 | 45 | 'sanitize_callback' => [$this, 'callbackRegisterSettings'], |
46 | - ]); |
|
46 | + ] ); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | 50 | * @return array |
51 | 51 | */ |
52 | - protected function sanitizeGeneral(array $input, array $options) |
|
52 | + protected function sanitizeGeneral( array $input, array $options ) |
|
53 | 53 | { |
54 | 54 | $key = 'settings.general'; |
55 | - $inputForm = Arr::get($input, $key); |
|
56 | - if (!$this->hasMultilingualIntegration(Arr::get($inputForm, 'multilingual'))) { |
|
57 | - $options = Arr::set($options, $key.'.multilingual', ''); |
|
55 | + $inputForm = Arr::get( $input, $key ); |
|
56 | + if( !$this->hasMultilingualIntegration( Arr::get( $inputForm, 'multilingual' ) ) ) { |
|
57 | + $options = Arr::set( $options, $key.'.multilingual', '' ); |
|
58 | 58 | } |
59 | - if ('' == trim(Arr::get($inputForm, 'notification_message'))) { |
|
60 | - $defaultValue = Arr::get(glsr()->defaults, $key.'.notification_message'); |
|
61 | - $options = Arr::set($options, $key.'.notification_message', $defaultValue); |
|
59 | + if( '' == trim( Arr::get( $inputForm, 'notification_message' ) ) ) { |
|
60 | + $defaultValue = Arr::get( glsr()->defaults, $key.'.notification_message' ); |
|
61 | + $options = Arr::set( $options, $key.'.notification_message', $defaultValue ); |
|
62 | 62 | } |
63 | - $defaultValue = Arr::get($inputForm, 'notifications', []); |
|
64 | - $options = Arr::set($options, $key.'.notifications', $defaultValue); |
|
63 | + $defaultValue = Arr::get( $inputForm, 'notifications', [] ); |
|
64 | + $options = Arr::set( $options, $key.'.notifications', $defaultValue ); |
|
65 | 65 | return $options; |
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
69 | 69 | * @return array |
70 | 70 | */ |
71 | - protected function sanitizeLicenses(array $input, array $options) |
|
71 | + protected function sanitizeLicenses( array $input, array $options ) |
|
72 | 72 | { |
73 | 73 | $key = 'settings.licenses'; |
74 | - $licenses = Arr::consolidateArray(Arr::get($input, $key)); |
|
75 | - foreach ($licenses as $slug => &$license) { |
|
76 | - if (empty($license)) { |
|
74 | + $licenses = Arr::consolidateArray( Arr::get( $input, $key ) ); |
|
75 | + foreach( $licenses as $slug => &$license ) { |
|
76 | + if( empty($license) ) { |
|
77 | 77 | continue; |
78 | 78 | } |
79 | - $license = $this->verifyLicense($license, $slug); |
|
79 | + $license = $this->verifyLicense( $license, $slug ); |
|
80 | 80 | } |
81 | - $options = Arr::set($options, $key, $licenses); |
|
81 | + $options = Arr::set( $options, $key, $licenses ); |
|
82 | 82 | return $options; |
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
86 | 86 | * @return array |
87 | 87 | */ |
88 | - protected function sanitizeSubmissions(array $input, array $options) |
|
88 | + protected function sanitizeSubmissions( array $input, array $options ) |
|
89 | 89 | { |
90 | 90 | $key = 'settings.submissions'; |
91 | - $inputForm = Arr::get($input, $key); |
|
91 | + $inputForm = Arr::get( $input, $key ); |
|
92 | 92 | $defaultValue = isset($inputForm['required']) |
93 | 93 | ? $inputForm['required'] |
94 | 94 | : []; |
95 | - $options = Arr::set($options, $key.'.required', $defaultValue); |
|
95 | + $options = Arr::set( $options, $key.'.required', $defaultValue ); |
|
96 | 96 | return $options; |
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
100 | 100 | * @return array |
101 | 101 | */ |
102 | - protected function sanitizeTranslations(array $input, array $options) |
|
102 | + protected function sanitizeTranslations( array $input, array $options ) |
|
103 | 103 | { |
104 | 104 | $key = 'settings.strings'; |
105 | - $inputForm = Arr::consolidateArray(Arr::get($input, $key)); |
|
106 | - if (!empty($inputForm)) { |
|
107 | - $options = Arr::set($options, $key, array_values(array_filter($inputForm))); |
|
105 | + $inputForm = Arr::consolidateArray( Arr::get( $input, $key ) ); |
|
106 | + if( !empty($inputForm) ) { |
|
107 | + $options = Arr::set( $options, $key, array_values( array_filter( $inputForm ) ) ); |
|
108 | 108 | $allowedTags = [ |
109 | 109 | 'a' => ['class' => [], 'href' => [], 'target' => []], |
110 | 110 | 'span' => ['class' => []], |
111 | 111 | ]; |
112 | - array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) { |
|
113 | - if (isset($string['s2'])) { |
|
114 | - $string['s2'] = wp_kses($string['s2'], $allowedTags); |
|
112 | + array_walk( $options['settings']['strings'], function( &$string ) use ($allowedTags) { |
|
113 | + if( isset($string['s2']) ) { |
|
114 | + $string['s2'] = wp_kses( $string['s2'], $allowedTags ); |
|
115 | 115 | } |
116 | - if (isset($string['p2'])) { |
|
117 | - $string['p2'] = wp_kses($string['p2'], $allowedTags); |
|
116 | + if( isset($string['p2']) ) { |
|
117 | + $string['p2'] = wp_kses( $string['p2'], $allowedTags ); |
|
118 | 118 | } |
119 | 119 | }); |
120 | 120 | } |
@@ -125,24 +125,24 @@ discard block |
||
125 | 125 | * @param string $integrationSlug |
126 | 126 | * @return bool |
127 | 127 | */ |
128 | - protected function hasMultilingualIntegration($integrationSlug) |
|
128 | + protected function hasMultilingualIntegration( $integrationSlug ) |
|
129 | 129 | { |
130 | - $integration = glsr(Multilingual::class)->getIntegration($integrationSlug); |
|
131 | - if (!$integration) { |
|
130 | + $integration = glsr( Multilingual::class )->getIntegration( $integrationSlug ); |
|
131 | + if( !$integration ) { |
|
132 | 132 | return false; |
133 | 133 | } |
134 | - if (!$integration->isActive()) { |
|
135 | - glsr(Notice::class)->addError(sprintf( |
|
136 | - __('Please install/activate the %s plugin to enable integration.', 'site-reviews'), |
|
134 | + if( !$integration->isActive() ) { |
|
135 | + glsr( Notice::class )->addError( sprintf( |
|
136 | + __( 'Please install/activate the %s plugin to enable integration.', 'site-reviews' ), |
|
137 | 137 | $integration->pluginName |
138 | - )); |
|
138 | + ) ); |
|
139 | 139 | return false; |
140 | - } elseif (!$integration->isSupported()) { |
|
141 | - glsr(Notice::class)->addError(sprintf( |
|
142 | - __('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'), |
|
140 | + } elseif( !$integration->isSupported() ) { |
|
141 | + glsr( Notice::class )->addError( sprintf( |
|
142 | + __( 'Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews' ), |
|
143 | 143 | $integration->pluginName, |
144 | 144 | $integration->supportedVersion |
145 | - )); |
|
145 | + ) ); |
|
146 | 146 | return false; |
147 | 147 | } |
148 | 148 | return true; |
@@ -153,21 +153,21 @@ discard block |
||
153 | 153 | * @param string $slug |
154 | 154 | * @return string |
155 | 155 | */ |
156 | - protected function verifyLicense($license, $slug) |
|
156 | + protected function verifyLicense( $license, $slug ) |
|
157 | 157 | { |
158 | 158 | try { |
159 | - $addon = glsr($slug); |
|
160 | - $updater = new Updater($addon->update_url, $addon->file, [ |
|
159 | + $addon = glsr( $slug ); |
|
160 | + $updater = new Updater( $addon->update_url, $addon->file, [ |
|
161 | 161 | 'license' => $license, |
162 | 162 | 'testedTo' => $addon->testedTo, |
163 | - ]); |
|
164 | - if (!$updater->isLicenseValid()) { |
|
165 | - throw new Exception('Invalid license: '.$license.' ('.$addon->id.')'); |
|
163 | + ] ); |
|
164 | + if( !$updater->isLicenseValid() ) { |
|
165 | + throw new Exception( 'Invalid license: '.$license.' ('.$addon->id.')' ); |
|
166 | 166 | } |
167 | - } catch (Exception $e) { |
|
167 | + } catch( Exception $e ) { |
|
168 | 168 | $license = ''; |
169 | - glsr_log()->debug($e->getMessage()); |
|
170 | - glsr(Notice::class)->addError(__('A license you entered was invalid.', 'site-reviews')); |
|
169 | + glsr_log()->debug( $e->getMessage() ); |
|
170 | + glsr( Notice::class )->addError( __( 'A license you entered was invalid.', 'site-reviews' ) ); |
|
171 | 171 | } |
172 | 172 | return $license; |
173 | 173 | } |