Automattic / Automattic/VIP-Coding-Standards

Flag incorrectly constructed mailto links

Ouverte
#556 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Type: Enhancement
Langage dominant
PHP
Étoiles
261
Forks
44
Merge moyen
19 min
PR mergées (30 j)
1

Description

## What problem would the enhancement address for VIP?

Some developers are not aware that `esc_url()` supports more than just the `http` and `https` protocols. The default list also includes ftp, ftps, mailto, news, irc, gopher, nntp, feed, and telnet as well.

of those extra ones, the most common is `mailto`, and a common mistake is to split a URL into a static `'mailto:'` and a email address variable/string escaped with something that isn't `esc_url()`.

## Describe the solution you'd like

Add a new sniff, or consider improving ProperEscapingFunction, so that we look for `'mailto:' string before an escaping function.

## What code should be reported as a violation?

```php
Email us

Email us

Email us

Email us

Email us

Email us
```

There are likely other ways to get a similar output.

## What code should *not* be reported as a violation?

```php
Email us

">Email us
```

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par le sniff ProperEscapingFunction mentionné dans l’issue et comparez son traitement des exemples PHP listés qui sont en infraction et de ceux qui ne le sont pas. Le travail est terminé lorsque les liens mailto construits incorrectement sont signalés, tandis que les valeurs mailto transmises à esc_url() sont acceptées.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
php, wordpress
Domaine
tooling
Type d'issue
Fonctionnalité
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.