/home/vianto5/heredit.mx/wp-content/plugins/wpforms-webhooks/src/Helpers
Edit: /home/vianto5/heredit.mx/wp-content/plugins/wpforms-webhooks/src/Helpers/Formatting.php (3035B)
254
) {
continue;
}
$sanitized .= $value[ $i ];
}
/**
* Filter a sanitized HTTP header value.
*
* @since 1.0.0
*
* @param string $sanitized The sanitized HTTP header value.
* @param string $value HTTP header value before sanitization.
*/
return apply_filters( 'wpforms_webhooks_formatting_sanitize_header_value', $sanitized, $value );
}
/**
* Check if a string is a valid URL.
* If debugging is on - localhost-environments is included to whitelist.
*
* @since 1.0.0
*
* @param string $url Input URL.
*
* @return bool
*/
public static function is_url( $url ) {
$valid = wpforms_is_url( $url );
// Return result if it's not debugging.
if ( ! wpforms_debug() ) {
return $valid;
}
// Return result if URL already valid.
if ( $valid ) {
return $valid;
}
// Array for testing on local environment.
$whitelist = [ 'localhost', '127.0.0.1', '192.168.' ];
foreach ( $whitelist as $env ) {
if ( false !== strpos( $url, $env ) ) {
$valid = true;
break;
}
}
return $valid;
}
/**
* Decode currency symbols in string.
*
* @since 1.4.0
*
* @param string $str String with encoded currency symbols.
*
* @return string String with decoded currency symbols.
*/
public static function decode_currency_symbols( $str ): string {
foreach ( wpforms_get_currencies() as $currency ) {
$symbol = $currency['symbol'] ?? '';
$str = str_replace( $symbol, html_entity_decode( $symbol ), $str );
}
return $str;
}
}