Completed
Push — master ( af3765...d123e6 )
by Stephanie
04:26
created
classes/models/FrmAddon.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -292,6 +292,9 @@
 block discarded – undo
292 292
 		wp_die();
293 293
 	}
294 294
 
295
+	/**
296
+	 * @param string $action
297
+	 */
295 298
 	public function send_mothership_request( $action ) {
296 299
 		$api_params = array(
297 300
 			'edd_action' => $action,
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 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
 	}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	public function show_license_message( $file, $plugin ) {
101 101
 		$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
102 102
 		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">';
103
-		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>' );
103
+		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>' );
104 104
 		$id = sanitize_title( $plugin['Name'] );
105 105
 		echo '<script type="text/javascript">var d = document.getElementById("' . esc_attr( $id ) . '");if ( d !== null ){ d.className = d.className + " update"; }</script>';
106 106
 		echo '</div></td></tr>';
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
 
114 114
 		if ( $this->is_current_version( $transient ) ) {
115 115
 			//make sure it doesn't show there is an update if plugin is up-to-date
116
-			if ( isset( $transient->response[ $this->plugin_folder ] ) ) {
117
-				unset( $transient->response[ $this->plugin_folder ] );
116
+			if ( isset( $transient->response[$this->plugin_folder] ) ) {
117
+				unset( $transient->response[$this->plugin_folder] );
118 118
 			}
119
-		} else if ( isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) ) {
119
+		} else if ( isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) ) {
120 120
 			$cache_key = 'edd_plugin_' . md5( sanitize_key( $this->license . $this->version ) . '_get_version' );
121 121
 			$version_info = get_transient( $cache_key );
122 122
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 			}
128 128
 
129 129
 			if ( $version_info !== false && version_compare( $version_info->new_version, $this->version, '>' ) ) {
130
-				$transient->response[ $this->plugin_folder ] = $version_info;
130
+				$transient->response[$this->plugin_folder] = $version_info;
131 131
 			} else {
132 132
 				delete_transient( $cache_key );
133 133
 				if ( ! $this->has_been_cleared() ) {
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 					$this->manually_queue_update();
137 137
 				}
138 138
 
139
-				unset( $transient->response[ $this->plugin_folder ] );
139
+				unset( $transient->response[$this->plugin_folder] );
140 140
 			}
141 141
 		}
142 142
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	}
145 145
 
146 146
 	private function is_current_version( $transient ) {
147
-		if ( empty( $transient->checked ) || ! isset( $transient->checked[ $this->plugin_folder ] ) ) {
147
+		if ( empty( $transient->checked ) || ! isset( $transient->checked[$this->plugin_folder] ) ) {
148 148
 			return false;
149 149
 		}
150 150
 
@@ -153,16 +153,16 @@  discard block
 block discarded – undo
153 153
 			return true;
154 154
 		}
155 155
 
156
-		return isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) && $transient->checked[ $this->plugin_folder ] == $transient->response[ $this->plugin_folder ]->new_version;
156
+		return isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) && $transient->checked[$this->plugin_folder] == $transient->response[$this->plugin_folder]->new_version;
157 157
 	}
158 158
 
159 159
 	private function has_been_cleared() {
160 160
 		$last_cleared = get_option( 'frm_last_cleared' );
161
-		return ( $last_cleared && $last_cleared > date( 'Y-m-d H:i:s', strtotime('-5 minutes') ) );
161
+		return ( $last_cleared && $last_cleared > date( 'Y-m-d H:i:s', strtotime( '-5 minutes' ) ) );
162 162
 	}
163 163
 
164 164
 	private function cleared_plugins() {
165
-		update_option( 'frm_last_cleared', date('Y-m-d H:i:s') );
165
+		update_option( 'frm_last_cleared', date( 'Y-m-d H:i:s' ) );
166 166
 	}
167 167
 
168 168
 	private function is_license_revoked() {
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	}
187 187
 
188 188
 	public static function activate() {
189
-		FrmAppHelper::permission_check('frm_change_settings');
189
+		FrmAppHelper::permission_check( 'frm_change_settings' );
190 190
 	 	check_ajax_referer( 'frm_ajax', 'nonce' );
191 191
 
192 192
 		if ( ! isset( $_POST['license'] ) || empty( $_POST['license'] ) ) {
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 			$response['message'] = $response['status'];
208 208
 		} else {
209 209
 			$messages = $this_plugin->get_messages();
210
-			if ( is_string( $response['status'] ) && isset( $messages[ $response['status'] ] ) ) {
211
-				$response['message'] = $messages[ $response['status'] ];
210
+			if ( is_string( $response['status'] ) && isset( $messages[$response['status']] ) ) {
211
+				$response['message'] = $messages[$response['status']];
212 212
 			} else {
213 213
 				$response['message'] = FrmAppHelper::kses( $response['status'], array( 'a' ) );
214 214
 			}
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	}
265 265
 
266 266
 	public static function deactivate() {
267
-		FrmAppHelper::permission_check('frm_change_settings');
267
+		FrmAppHelper::permission_check( 'frm_change_settings' );
268 268
 		check_ajax_referer( 'frm_ajax', 'nonce' );
269 269
 
270 270
 		$plugin_slug = sanitize_text_field( $_POST['plugin'] );
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 
316 316
 		$message = __( 'Your License Key was invalid', 'formidable' );
317 317
 		if ( is_wp_error( $resp ) ) {
318
-			$message = sprintf( __( 'You had an error communicating with Formidable Pro\'s API. %1$sClick here%2$s for more information.', 'formidable' ), '<a href="http://formidablepro.com/knowledgebase/why-cant-i-activate-formidable-pro/" target="_blank">', '</a>');
318
+			$message = sprintf( __( 'You had an error communicating with Formidable Pro\'s API. %1$sClick here%2$s for more information.', 'formidable' ), '<a href="http://formidablepro.com/knowledgebase/why-cant-i-activate-formidable-pro/" target="_blank">', '</a>' );
319 319
 			$message .= ' ' . $resp->get_error_message();
320 320
 		} else if ( $body == 'error' || is_wp_error( $body ) ) {
321 321
 			$message = __( 'You had an HTTP error connecting to Formidable Pro\'s API', 'formidable' );
Please login to merge, or discard this patch.