| @@ -202,8 +202,45 @@ | ||
| 202 | 202 | if ( !$isActive ) { |
| 203 | 203 | return $links; |
| 204 | 204 | } |
| 205 | 205 | $isIssue = $this->isPro && !$this->is_registered(); |
| 206 | + | |
| 207 | + // The licenser already knows WHY validation failed and stores it as | |
| 208 | + // license['issue'] (licenser.php), but this badge used to render a flat | |
| 209 | + // "License Issue" for every case. That sent people to support to ask a | |
| 210 | + // question the plugin could have answered: the most common one by far is a | |
| 211 | + // licence whose activation slot is held by another site, which reads as | |
| 212 | + // "my licence is broken" and gets reported as a billing problem. | |
| 213 | + $issueLabel = __( 'License Issue', $this->domain ); | |
| 214 | + if ( $isIssue ) { | |
| 215 | + $license = get_option( $this->prefix . '_license', '' ); | |
| 216 | + $issue = is_array( $license ) && !empty( $license['issue'] ) ? $license['issue'] : null; | |
| 217 | + // Codes the store actually sends. Verified against EDD Software Licensing | |
| 218 | + // rather than guessed: an invented key would silently never match, and a | |
| 219 | + // wrong label is worse than the generic one. | |
| 220 | + $labels = [ | |
| 221 | + // `error` codes, from a failed activation. | |
| 222 | + 'no_activations_left' => __( 'License in use on another site', $this->domain ), | |
| 223 | + 'expired' => __( 'License expired', $this->domain ), | |
| 224 | + 'disabled' => __( 'License revoked', $this->domain ), | |
| 225 | + 'missing' => __( 'License key not recognized', $this->domain ), | |
| 226 | + 'key_mismatch' => __( 'License key not recognized', $this->domain ), | |
| 227 | + 'item_name_mismatch' => __( 'License is for another plugin', $this->domain ), | |
| 228 | + 'invalid_item_id' => __( 'License is for another plugin', $this->domain ), | |
| 229 | + 'missing_item_id' => __( 'License is for another plugin', $this->domain ), | |
| 230 | + 'bundle_activation_not_allowed' => __( 'This license cannot be activated directly', $this->domain ), | |
| 231 | + // `license` statuses, when the key is known but not valid here. | |
| 232 | + 'site_inactive' => __( 'License not activated on this site', $this->domain ), | |
| 233 | + 'inactive' => __( 'License not activated on this site', $this->domain ), | |
| 234 | + // Genuinely no answer from the store. NOT invalid_response, which means the | |
| 235 | + // store replied and we could not make sense of it: blaming the connection | |
| 236 | + // there would send people chasing a firewall that is working fine. | |
| 237 | + 'no_response' => __( 'License server unreachable', $this->domain ), | |
| 238 | + ]; | |
| 239 | + if ( $issue !== null && isset( $labels[ $issue ] ) ) { | |
| 240 | + $issueLabel = $labels[ $issue ]; | |
| 241 | + } | |
| 242 | + } | |
| 206 | 243 | if ( strpos( $pathName, $thisPathName ) !== false ) { |
| 207 | 244 | // In network admin, handle differently (no settings page available) |
| 208 | 245 | if ( is_network_admin() ) { |
| 209 | 246 | if ( $this->isPro && !$this->is_registered() ) { |
| @@ -244,9 +281,9 @@ | ||
| 244 | 281 | sprintf( __( '<a href="admin.php?page=%s_settings">Settings</a>', $this->domain ), $this->prefix ), |
| 245 | 282 | 'license' => |
| 246 | 283 | $this->is_registered() ? |
| 247 | 284 | ( '<span style="color: #a75bd6;">' . __( 'Pro Version', $this->domain ) . '</span>' ) : |
| 248 | - ( $isIssue ? ( sprintf( '<span style="color: #ff3434;">' . __( 'License Issue', $this->domain ), $this->prefix ) . '</span>' ) : ( sprintf( '<span>' . __( '<a target="_blank" href="https://meowapps.com">Get the <u>Pro Version</u></a>', $this->domain ), $this->prefix ) . '</span>' ) ), | |
| 285 | + ( $isIssue ? ( '<span style="color: #ff3434;">' . esc_html( $issueLabel ) . '</span>' ) : ( sprintf( '<span>' . __( '<a target="_blank" href="https://meowapps.com">Get the <u>Pro Version</u></a>', $this->domain ), $this->prefix ) . '</span>' ) ), | |
| 249 | 286 | ]; |
| 250 | 287 | } |
| 251 | 288 | $links = array_merge( $new_links, $links ); |
| 252 | 289 | } |