/** * Echo HTML tag for a link * */ function yourls_html_link($href, $title = '', $element = '') { if (!$title) { $title = $href; } if ($element) { $element = sprintf('id="%s"', yourls_esc_attr($element)); } $link = sprintf('<a href="%s" %s>%s</a>', yourls_esc_url($href), $element, yourls_esc_html($title)); echo yourls_apply_filter('html_link', $link); }
/** * A few sanity checks on the URL. Used for redirection or DB. For display purpose, see yourls_esc_url() * * @param string $unsafe_url unsafe URL * @param array $protocols Optional allowed protocols, default to global $yourls_allowedprotocols * @return string Safe URL */ function yourls_sanitize_url($unsafe_url, $protocols = array()) { $url = yourls_esc_url($unsafe_url, 'redirection', $protocols); return yourls_apply_filter('sanitize_url', $url, $unsafe_url); }
/** * A few sanity checks on the URL. Used for redirection or DB. For display purpose, see yourls_esc_url() * */ function yourls_sanitize_url($unsafe_url) { $url = yourls_esc_url($unsafe_url, 'redirection'); return yourls_apply_filter('sanitize_url', $url, $unsafe_url); }