Completed
Push — master ( b54fe3...253e75 )
by Stephanie
02:40
created
classes/models/FrmAddon.php 1 patch
Spacing   +23 added lines, -23 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.03.11
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,10 +162,10 @@  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 = 'edd_plugin_' . md5( sanitize_key( $this->license . $this->version ) . '_get_version' );
170 170
 			$version_info = get_transient( $cache_key );
171 171
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 			}
177 177
 
178 178
 			if ( $version_info !== false && version_compare( $version_info->new_version, $this->version, '>' ) ) {
179
-				$transient->response[ $this->plugin_folder ] = $version_info;
179
+				$transient->response[$this->plugin_folder] = $version_info;
180 180
 			} else {
181 181
 				delete_transient( $cache_key );
182 182
 				if ( ! $this->has_been_cleared() ) {
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 					$this->manually_queue_update();
186 186
 				}
187 187
 
188
-				unset( $transient->response[ $this->plugin_folder ] );
188
+				unset( $transient->response[$this->plugin_folder] );
189 189
 			}
190 190
 		}
191 191
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	}
194 194
 
195 195
 	private function is_current_version( $transient ) {
196
-		if ( empty( $transient->checked ) || ! isset( $transient->checked[ $this->plugin_folder ] ) ) {
196
+		if ( empty( $transient->checked ) || ! isset( $transient->checked[$this->plugin_folder] ) ) {
197 197
 			return false;
198 198
 		}
199 199
 
@@ -202,16 +202,16 @@  discard block
 block discarded – undo
202 202
 			return true;
203 203
 		}
204 204
 
205
-		return isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) && $transient->checked[ $this->plugin_folder ] == $transient->response[ $this->plugin_folder ]->new_version;
205
+		return isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) && $transient->checked[$this->plugin_folder] == $transient->response[$this->plugin_folder]->new_version;
206 206
 	}
207 207
 
208 208
 	private function has_been_cleared() {
209 209
 		$last_cleared = get_option( 'frm_last_cleared' );
210
-		return ( $last_cleared && $last_cleared > date( 'Y-m-d H:i:s', strtotime('-5 minutes') ) );
210
+		return ( $last_cleared && $last_cleared > date( 'Y-m-d H:i:s', strtotime( '-5 minutes' ) ) );
211 211
 	}
212 212
 
213 213
 	private function cleared_plugins() {
214
-		update_option( 'frm_last_cleared', date('Y-m-d H:i:s') );
214
+		update_option( 'frm_last_cleared', date( 'Y-m-d H:i:s' ) );
215 215
 	}
216 216
 
217 217
 	private function is_license_revoked() {
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 		}
221 221
 
222 222
 		$last_checked = get_site_option( $this->transient_key() );
223
-		$seven_days_ago = date( 'Y-m-d H:i:s', strtotime('-7 days') );
223
+		$seven_days_ago = date( 'Y-m-d H:i:s', strtotime( '-7 days' ) );
224 224
 
225 225
 		if ( ! $last_checked || $last_checked < $seven_days_ago ) {
226 226
 			update_site_option( $this->transient_key(), date( 'Y-m-d H:i:s' ) ); // check weekly
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	}
237 237
 
238 238
 	public static function activate() {
239
-		FrmAppHelper::permission_check('frm_change_settings');
239
+		FrmAppHelper::permission_check( 'frm_change_settings' );
240 240
 	 	check_ajax_referer( 'frm_ajax', 'nonce' );
241 241
 
242 242
 		if ( ! isset( $_POST['license'] ) || empty( $_POST['license'] ) ) {
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
 			$response['message'] = $response['status'];
265 265
 		} else {
266 266
 			$messages = $this->get_messages();
267
-			if ( is_string( $response['status'] ) && isset( $messages[ $response['status'] ] ) ) {
268
-				$response['message'] = $messages[ $response['status'] ];
267
+			if ( is_string( $response['status'] ) && isset( $messages[$response['status']] ) ) {
268
+				$response['message'] = $messages[$response['status']];
269 269
 			} else {
270 270
 				$response['message'] = FrmAppHelper::kses( $response['status'], array( 'a' ) );
271 271
 			}
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	}
321 321
 
322 322
 	public static function deactivate() {
323
-		FrmAppHelper::permission_check('frm_change_settings');
323
+		FrmAppHelper::permission_check( 'frm_change_settings' );
324 324
 		check_ajax_referer( 'frm_ajax', 'nonce' );
325 325
 
326 326
 		$plugin_slug = sanitize_text_field( $_POST['plugin'] );
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 
373 373
 		$message = __( 'Your License Key was invalid', 'formidable' );
374 374
 		if ( is_wp_error( $resp ) ) {
375
-			$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>');
375
+			$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>' );
376 376
 			$message .= ' ' . $resp->get_error_message();
377 377
 		} else if ( $body == 'error' || is_wp_error( $body ) ) {
378 378
 			$message = __( 'You had an HTTP error connecting to the Formidable API', 'formidable' );
Please login to merge, or discard this patch.