Automattic / Automattic/VIP-Coding-Standards

Flag incorrectly constructed mailto links

Aperta
#556 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Type: Enhancement
Lingua principale
PHP
Stelle
261
Fork
44
Merge medio
19m
PR unite (30g)
1

Descrizione

## 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
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con lo sniff ProperEscapingFunction menzionato nell’issue e confronta la sua gestione degli esempi PHP elencati che violano e non violano la regola. Il lavoro è completato quando vengono segnalati i link mailto costruiti in modo errato, mentre i valori mailto passati attraverso esc_url() vengono accettati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
php, wordpress
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.