|
@@ -38,15 +38,15 @@ discard block |
|
|
block discarded – undo |
|
38
|
38
|
} |
|
39
|
39
|
|
|
40
|
40
|
public function insert_installed_addon( $plugins ) { |
|
41
|
|
- $plugins[ $this->plugin_slug ] = $this; |
|
|
41
|
+ $plugins[$this->plugin_slug] = $this; |
|
42
|
42
|
return $plugins; |
|
43
|
43
|
} |
|
44
|
44
|
|
|
45
|
45
|
public static function get_addon( $plugin_slug ) { |
|
46
|
46
|
$plugins = apply_filters( 'frm_installed_addons', array() ); |
|
47
|
47
|
$plugin = false; |
|
48
|
|
- if ( isset( $plugins[ $plugin_slug ] ) ) { |
|
49
|
|
- $plugin = $plugins[ $plugin_slug ]; |
|
|
48
|
+ if ( isset( $plugins[$plugin_slug] ) ) { |
|
|
49
|
+ $plugin = $plugins[$plugin_slug]; |
|
50
|
50
|
} |
|
51
|
51
|
return $plugin; |
|
52
|
52
|
} |
|
@@ -91,18 +91,18 @@ discard block |
|
|
block discarded – undo |
|
91
|
91
|
delete_option( $this->option_name . 'active' ); |
|
92
|
92
|
delete_option( $this->option_name . 'key' ); |
|
93
|
93
|
delete_site_transient( $this->transient_key() ); |
|
94
|
|
- delete_transient('frm_api_licence'); |
|
|
94
|
+ delete_transient( 'frm_api_licence' ); |
|
95
|
95
|
} |
|
96
|
96
|
|
|
97
|
97
|
public function set_active( $is_active ) { |
|
98
|
98
|
update_option( $this->option_name . 'active', $is_active ); |
|
99
|
|
- delete_transient('frm_api_licence'); |
|
|
99
|
+ delete_transient( 'frm_api_licence' ); |
|
100
|
100
|
} |
|
101
|
101
|
|
|
102
|
102
|
public function show_license_message( $file, $plugin ) { |
|
103
|
103
|
$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
|
104
|
104
|
echo '<tr class="plugin-update-tr active"><td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"><div class="update-message">'; |
|
105
|
|
- echo sprintf( __( 'Your %1$s license key is missing. Please add it on the %2$slicenses page%3$s.', 'formidable' ), $this->plugin_name, '<a href="' . esc_url( admin_url('admin.php?page=formidable-settings&t=licenses_settings' ) ) . '">', '</a>' ); |
|
|
105
|
+ echo sprintf( __( 'Your %1$s license key is missing. Please add it on the %2$slicenses page%3$s.', 'formidable' ), $this->plugin_name, '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings&t=licenses_settings' ) ) . '">', '</a>' ); |
|
106
|
106
|
$id = sanitize_title( $plugin['Name'] ); |
|
107
|
107
|
echo '<script type="text/javascript">var d = document.getElementById("' . esc_attr( $id ) . '");if ( d !== null ){ d.className = d.className + " update"; }</script>'; |
|
108
|
108
|
echo '</div></td></tr>'; |
|
@@ -115,10 +115,10 @@ discard block |
|
|
block discarded – undo |
|
115
|
115
|
|
|
116
|
116
|
if ( $this->is_current_version( $transient ) ) { |
|
117
|
117
|
//make sure it doesn't show there is an update if plugin is up-to-date |
|
118
|
|
- if ( isset( $transient->response[ $this->plugin_folder ] ) ) { |
|
119
|
|
- unset( $transient->response[ $this->plugin_folder ] ); |
|
|
118
|
+ if ( isset( $transient->response[$this->plugin_folder] ) ) { |
|
|
119
|
+ unset( $transient->response[$this->plugin_folder] ); |
|
120
|
120
|
} |
|
121
|
|
- } else if ( isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) ) { |
|
|
121
|
+ } else if ( isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) ) { |
|
122
|
122
|
$cache_key = 'edd_plugin_' . md5( sanitize_key( $this->license . $this->version ) . '_get_version' ); |
|
123
|
123
|
$version_info = get_transient( $cache_key ); |
|
124
|
124
|
|
|
@@ -129,7 +129,7 @@ discard block |
|
|
block discarded – undo |
|
129
|
129
|
} |
|
130
|
130
|
|
|
131
|
131
|
if ( $version_info !== false && version_compare( $version_info->new_version, $this->version, '>' ) ) { |
|
132
|
|
- $transient->response[ $this->plugin_folder ] = $version_info; |
|
|
132
|
+ $transient->response[$this->plugin_folder] = $version_info; |
|
133
|
133
|
} else { |
|
134
|
134
|
delete_transient( $cache_key ); |
|
135
|
135
|
if ( ! $this->has_been_cleared() ) { |
|
@@ -138,7 +138,7 @@ discard block |
|
|
block discarded – undo |
|
138
|
138
|
$this->manually_queue_update(); |
|
139
|
139
|
} |
|
140
|
140
|
|
|
141
|
|
- unset( $transient->response[ $this->plugin_folder ] ); |
|
|
141
|
+ unset( $transient->response[$this->plugin_folder] ); |
|
142
|
142
|
} |
|
143
|
143
|
} |
|
144
|
144
|
|
|
@@ -146,7 +146,7 @@ discard block |
|
|
block discarded – undo |
|
146
|
146
|
} |
|
147
|
147
|
|
|
148
|
148
|
private function is_current_version( $transient ) { |
|
149
|
|
- if ( empty( $transient->checked ) || ! isset( $transient->checked[ $this->plugin_folder ] ) ) { |
|
|
149
|
+ if ( empty( $transient->checked ) || ! isset( $transient->checked[$this->plugin_folder] ) ) { |
|
150
|
150
|
return false; |
|
151
|
151
|
} |
|
152
|
152
|
|
|
@@ -155,16 +155,16 @@ discard block |
|
|
block discarded – undo |
|
155
|
155
|
return true; |
|
156
|
156
|
} |
|
157
|
157
|
|
|
158
|
|
- return isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) && $transient->checked[ $this->plugin_folder ] == $transient->response[ $this->plugin_folder ]->new_version; |
|
|
158
|
+ return isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) && $transient->checked[$this->plugin_folder] == $transient->response[$this->plugin_folder]->new_version; |
|
159
|
159
|
} |
|
160
|
160
|
|
|
161
|
161
|
private function has_been_cleared() { |
|
162
|
162
|
$last_cleared = get_option( 'frm_last_cleared' ); |
|
163
|
|
- return ( $last_cleared && $last_cleared > date( 'Y-m-d H:i:s', strtotime('-5 minutes') ) ); |
|
|
163
|
+ return ( $last_cleared && $last_cleared > date( 'Y-m-d H:i:s', strtotime( '-5 minutes' ) ) ); |
|
164
|
164
|
} |
|
165
|
165
|
|
|
166
|
166
|
private function cleared_plugins() { |
|
167
|
|
- update_option( 'frm_last_cleared', date('Y-m-d H:i:s') ); |
|
|
167
|
+ update_option( 'frm_last_cleared', date( 'Y-m-d H:i:s' ) ); |
|
168
|
168
|
} |
|
169
|
169
|
|
|
170
|
170
|
private function is_license_revoked() { |
|
@@ -173,7 +173,7 @@ discard block |
|
|
block discarded – undo |
|
173
|
173
|
} |
|
174
|
174
|
|
|
175
|
175
|
$last_checked = get_site_option( $this->transient_key() ); |
|
176
|
|
- $seven_days_ago = date( 'Y-m-d H:i:s', strtotime('-7 days') ); |
|
|
176
|
+ $seven_days_ago = date( 'Y-m-d H:i:s', strtotime( '-7 days' ) ); |
|
177
|
177
|
|
|
178
|
178
|
if ( ! $last_checked || $last_checked < $seven_days_ago ) { |
|
179
|
179
|
update_site_option( $this->transient_key(), date( 'Y-m-d H:i:s' ) ); // check weekly |
|
@@ -189,7 +189,7 @@ discard block |
|
|
block discarded – undo |
|
189
|
189
|
} |
|
190
|
190
|
|
|
191
|
191
|
public static function activate() { |
|
192
|
|
- FrmAppHelper::permission_check('frm_change_settings'); |
|
|
192
|
+ FrmAppHelper::permission_check( 'frm_change_settings' ); |
|
193
|
193
|
check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
194
|
194
|
|
|
195
|
195
|
if ( ! isset( $_POST['license'] ) || empty( $_POST['license'] ) ) { |
|
@@ -210,8 +210,8 @@ discard block |
|
|
block discarded – undo |
|
210
|
210
|
$response['message'] = $response['status']; |
|
211
|
211
|
} else { |
|
212
|
212
|
$messages = $this_plugin->get_messages(); |
|
213
|
|
- if ( is_string( $response['status'] ) && isset( $messages[ $response['status'] ] ) ) { |
|
214
|
|
- $response['message'] = $messages[ $response['status'] ]; |
|
|
213
|
+ if ( is_string( $response['status'] ) && isset( $messages[$response['status']] ) ) { |
|
|
214
|
+ $response['message'] = $messages[$response['status']]; |
|
215
|
215
|
} else { |
|
216
|
216
|
$response['message'] = FrmAppHelper::kses( $response['status'], array( 'a' ) ); |
|
217
|
217
|
} |
|
@@ -267,7 +267,7 @@ discard block |
|
|
block discarded – undo |
|
267
|
267
|
} |
|
268
|
268
|
|
|
269
|
269
|
public static function deactivate() { |
|
270
|
|
- FrmAppHelper::permission_check('frm_change_settings'); |
|
|
270
|
+ FrmAppHelper::permission_check( 'frm_change_settings' ); |
|
271
|
271
|
check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
272
|
272
|
|
|
273
|
273
|
$plugin_slug = sanitize_text_field( $_POST['plugin'] ); |
|
@@ -319,7 +319,7 @@ discard block |
|
|
block discarded – undo |
|
319
|
319
|
|
|
320
|
320
|
$message = __( 'Your License Key was invalid', 'formidable' ); |
|
321
|
321
|
if ( is_wp_error( $resp ) ) { |
|
322
|
|
- $message = sprintf( __( 'You had an error communicating with the Formidable API. %1$sClick here%2$s for more information.', 'formidable' ), '<a href="https://formidableforms.com/knowledgebase/why-cant-i-activate-formidable-pro/" target="_blank">', '</a>'); |
|
|
322
|
+ $message = sprintf( __( 'You had an error communicating with the Formidable API. %1$sClick here%2$s for more information.', 'formidable' ), '<a href="https://formidableforms.com/knowledgebase/why-cant-i-activate-formidable-pro/" target="_blank">', '</a>' ); |
|
323
|
323
|
$message .= ' ' . $resp->get_error_message(); |
|
324
|
324
|
} else if ( $body == 'error' || is_wp_error( $body ) ) { |
|
325
|
325
|
$message = __( 'You had an HTTP error connecting to the Formidable API', 'formidable' ); |