wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi
block_core_navigation_link_maybe_urldecode › WordPress Function
Da6.2.0
Deprecaton/a
› block_core_navigation_link_maybe_urldecode ( $url )
| Parametri: |
|
| Ritorna: |
|
| Definito a: |
|
| Codex: |
Decodes a url if it's encoded, returning the same url if not.
Sorgenti
function block_core_navigation_link_maybe_urldecode( $url ) {
if ( ! is_string( $url ) ) {
return '';
}
$is_url_encoded = false;
$query = parse_url( $url, PHP_URL_QUERY );
$query_params = wp_parse_args( $query );
foreach ( $query_params as $query_param ) {
$can_query_param_be_encoded = is_string( $query_param ) && ! empty( $query_param );
if ( ! $can_query_param_be_encoded ) {
continue;
}
if ( rawurldecode( $query_param ) !== $query_param ) {
$is_url_encoded = true;
break;
}
}
if ( $is_url_encoded ) {
return rawurldecode( $url );
}
return $url;
}