Add ircs and irc6 to the list of allowed protocols.

This adds support for the secure and ipv6 variants of the already allowed irc protocol.

Props arealnobrainer, markparnell, ctmartin.


git-svn-id: https://develop.svn.wordpress.org/trunk@49055 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Timothy Jacobs 2020-09-26 21:00:19 +00:00
parent 9b9b59c4ee
commit 4ad4eeaf7d
3 changed files with 8 additions and 3 deletions

View File

@ -6295,13 +6295,14 @@ function send_frame_options_header() {
* @since 4.3.0 Added 'webcal' to the protocols array.
* @since 4.7.0 Added 'urn' to the protocols array.
* @since 5.3.0 Added 'sms' to the protocols array.
* @since 5.6.0 Added 'irc6' and 'ircs' to the protocols array.
*
* @see wp_kses()
* @see esc_url()
*
* @return string[] Array of allowed protocols. Defaults to an array containing 'http', 'https',
* 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet',
* 'mms', 'rtsp', 'sms', 'svn', 'tel', 'fax', 'xmpp', 'webcal', and 'urn'.
* 'ftp', 'ftps', 'mailto', 'news', 'irc', 'irc6', 'ircs', 'gopher', 'nntp', 'feed',
* 'telnet', 'mms', 'rtsp', 'sms', 'svn', 'tel', 'fax', 'xmpp', 'webcal', and 'urn'.
* This covers all common link protocols, except for 'javascript' which should not
* be allowed for untrusted users.
*/
@ -6309,7 +6310,7 @@ function wp_allowed_protocols() {
static $protocols = array();
if ( empty( $protocols ) ) {
$protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'sms', 'svn', 'tel', 'fax', 'xmpp', 'webcal', 'urn' );
$protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'irc6', 'ircs', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'sms', 'svn', 'tel', 'fax', 'xmpp', 'webcal', 'urn' );
}
if ( ! did_action( 'wp_loaded' ) ) {

View File

@ -516,6 +516,8 @@ class Test_WP_Customize_Nav_Menu_Item_Setting extends WP_UnitTestCase {
'ftps://example.com/',
'news://news.server.example/example.group.this',
'irc://irc.freenode.net/wordpress',
'irc6://irc.freenode.net/wordpress',
'ircs://irc.freenode.net/wordpress',
'gopher://example.com',
'nntp://news.server.example/example.group.this',
'feed://example.com/',

View File

@ -46,6 +46,8 @@ class Tests_Functions_AllowedProtocols extends WP_UnitTestCase {
array( 'mailto', 'mailto://someone@example.com' ), // RFC6068
array( 'news', 'news://news.server.example/example.group.this' ), // RFC5538
array( 'irc', 'irc://example.com/wordpress' ),
array( 'irc6', 'irc6://example.com/wordpress' ),
array( 'ircs', 'ircs://example.com/wordpress' ),
array( 'gopher', 'gopher://example.com/7a_gopher_selector%09foobar' ), // RFC4266
array( 'nntp', 'nntp://news.server.example/example.group.this' ), // RFC5538
array( 'feed', 'feed://example.com/rss.xml' ),