Completed
Push — master ( d52ec6...f57973 )
by Stephanie
02:32
created
classes/models/FrmAddon.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -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
 	}
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	 * @since 2.04
123 123
 	 */
124 124
 	private function is_time_to_auto_activate() {
125
-		$last_try = get_option( $this->option_name .'last_activate' );
126
-		return ( ! $last_try || $last_try < strtotime('-1 day') );
125
+		$last_try = get_option( $this->option_name . 'last_activate' );
126
+		return ( ! $last_try || $last_try < strtotime( '-1 day' ) );
127 127
 	}
128 128
 
129 129
 	private function set_auto_activate_time() {
@@ -138,18 +138,18 @@  discard block
 block discarded – undo
138 138
 		delete_option( $this->option_name . 'active' );
139 139
 		delete_option( $this->option_name . 'key' );
140 140
 		delete_site_transient( $this->transient_key() );
141
-		delete_transient('frm_api_licence');
141
+		delete_transient( 'frm_api_licence' );
142 142
 	}
143 143
 
144 144
 	public function set_active( $is_active ) {
145 145
 		update_option( $this->option_name . 'active', $is_active );
146
-		delete_transient('frm_api_licence');
146
+		delete_transient( 'frm_api_licence' );
147 147
 	}
148 148
 
149 149
 	public function show_license_message( $file, $plugin ) {
150 150
 		$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
151 151
 		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">';
152
-		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>' );
152
+		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>' );
153 153
 		$id = sanitize_title( $plugin['Name'] );
154 154
 		echo '<script type="text/javascript">var d = document.getElementById("' . esc_attr( $id ) . '");if ( d !== null ){ d.className = d.className + " update"; }</script>';
155 155
 		echo '</div></td></tr>';
@@ -162,17 +162,17 @@  discard block
 block discarded – undo
162 162
 
163 163
 		if ( $this->is_current_version( $transient ) ) {
164 164
 			//make sure it doesn't show there is an update if plugin is up-to-date
165
-			if ( isset( $transient->response[ $this->plugin_folder ] ) ) {
166
-				unset( $transient->response[ $this->plugin_folder ] );
165
+			if ( isset( $transient->response[$this->plugin_folder] ) ) {
166
+				unset( $transient->response[$this->plugin_folder] );
167 167
 			}
168
-		} else if ( isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) ) {
168
+		} else if ( isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) ) {
169 169
 			$cache_key = $this->version_cache_key();
170 170
 			$version_info = get_transient( $cache_key );
171 171
 
172 172
 			$this->clear_old_plugin_version( $version_info );
173 173
 
174 174
 			if ( $version_info !== false && version_compare( $version_info->new_version, $this->version, '>' ) ) {
175
-				$transient->response[ $this->plugin_folder ] = $version_info;
175
+				$transient->response[$this->plugin_folder] = $version_info;
176 176
 			} else {
177 177
 				delete_transient( $cache_key );
178 178
 				if ( ! $this->has_been_cleared() ) {
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 					$this->manually_queue_update();
182 182
 				}
183 183
 
184
-				unset( $transient->response[ $this->plugin_folder ] );
184
+				unset( $transient->response[$this->plugin_folder] );
185 185
 			}
186 186
 		}
187 187
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 			if ( $expiration === false ) {
212 212
 				$last_checked = ( is_array( $version_info->sections ) && isset( $version_info->sections['last_checked'] ) ) ? $version_info->sections['last_checked'] : 0;
213 213
 
214
-				if ( $last_checked < strtotime('-48 hours') ) {
214
+				if ( $last_checked < strtotime( '-48 hours' ) ) {
215 215
 					$version_info = false;
216 216
 				}
217 217
 			}
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	}
220 220
 
221 221
 	private function is_current_version( $transient ) {
222
-		if ( empty( $transient->checked ) || ! isset( $transient->checked[ $this->plugin_folder ] ) ) {
222
+		if ( empty( $transient->checked ) || ! isset( $transient->checked[$this->plugin_folder] ) ) {
223 223
 			return false;
224 224
 		}
225 225
 
@@ -228,16 +228,16 @@  discard block
 block discarded – undo
228 228
 			return true;
229 229
 		}
230 230
 
231
-		return isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) && $transient->checked[ $this->plugin_folder ] == $transient->response[ $this->plugin_folder ]->new_version;
231
+		return isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) && $transient->checked[$this->plugin_folder] == $transient->response[$this->plugin_folder]->new_version;
232 232
 	}
233 233
 
234 234
 	private function has_been_cleared() {
235 235
 		$last_cleared = get_option( 'frm_last_cleared' );
236
-		return ( $last_cleared && $last_cleared > date( 'Y-m-d H:i:s', strtotime('-5 minutes') ) );
236
+		return ( $last_cleared && $last_cleared > date( 'Y-m-d H:i:s', strtotime( '-5 minutes' ) ) );
237 237
 	}
238 238
 
239 239
 	private function cleared_plugins() {
240
-		update_option( 'frm_last_cleared', date('Y-m-d H:i:s') );
240
+		update_option( 'frm_last_cleared', date( 'Y-m-d H:i:s' ) );
241 241
 	}
242 242
 
243 243
 	private function is_license_revoked() {
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 		}
247 247
 
248 248
 		$last_checked = get_site_option( $this->transient_key() );
249
-		$seven_days_ago = date( 'Y-m-d H:i:s', strtotime('-7 days') );
249
+		$seven_days_ago = date( 'Y-m-d H:i:s', strtotime( '-7 days' ) );
250 250
 
251 251
 		if ( ! $last_checked || $last_checked < $seven_days_ago ) {
252 252
 			update_site_option( $this->transient_key(), date( 'Y-m-d H:i:s' ) ); // check weekly
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	}
263 263
 
264 264
 	public static function activate() {
265
-		FrmAppHelper::permission_check('frm_change_settings');
265
+		FrmAppHelper::permission_check( 'frm_change_settings' );
266 266
 	 	check_ajax_referer( 'frm_ajax', 'nonce' );
267 267
 
268 268
 		if ( ! isset( $_POST['license'] ) || empty( $_POST['license'] ) ) {
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 			$response['message'] = $response['status'];
294 294
 		} else {
295 295
 			$messages = $this->get_messages();
296
-			if ( is_string( $response['status'] ) && isset( $messages[ $response['status'] ] ) ) {
297
-				$response['message'] = $messages[ $response['status'] ];
296
+			if ( is_string( $response['status'] ) && isset( $messages[$response['status']] ) ) {
297
+				$response['message'] = $messages[$response['status']];
298 298
 			} else {
299 299
 				$response['message'] = FrmAppHelper::kses( $response['status'], array( 'a' ) );
300 300
 			}
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 	}
350 350
 
351 351
 	public static function deactivate() {
352
-		FrmAppHelper::permission_check('frm_change_settings');
352
+		FrmAppHelper::permission_check( 'frm_change_settings' );
353 353
 		check_ajax_referer( 'frm_ajax', 'nonce' );
354 354
 
355 355
 		$plugin_slug = sanitize_text_field( $_POST['plugin'] );
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 
402 402
 		$message = __( 'Your License Key was invalid', 'formidable' );
403 403
 		if ( is_wp_error( $resp ) ) {
404
-			$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>');
404
+			$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>' );
405 405
 			$message .= ' ' . $resp->get_error_message();
406 406
 		} else if ( $body == 'error' || is_wp_error( $body ) ) {
407 407
 			$message = __( 'You had an HTTP error connecting to the Formidable API', 'formidable' );
Please login to merge, or discard this patch.