mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-76131 core_user: encode social profile fields data.
This commit is contained in:
parent
5548743ece
commit
8a4d06bcaa
@ -66,9 +66,9 @@ class helper {
|
||||
*/
|
||||
public static function get_network_urls(): array {
|
||||
return [
|
||||
'skype' => '<a href="skype:%%DATA%%?call">%%DATA%%</a>',
|
||||
'icq' => '<a href="http://www.icq.com/whitepages/cmd.php?uin=%%DATA%%&action=message">%%DATA%%</a>',
|
||||
'url' => '<a href="%%DATA%%">%%DATA%%</a>'
|
||||
'skype' => '<a href="skype:%%ENCODED%%?call">%%PLAIN%%</a>',
|
||||
'icq' => '<a href="http://www.icq.com/whitepages/cmd.php?uin=%%ENCODED%%&action=message">%%PLAIN%%</a>',
|
||||
'url' => '<a href="%%PLAIN%%">%%PLAIN%%</a>'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,9 @@ class profile_field_social extends profile_field_base {
|
||||
$networkurls = profilefield_social\helper::get_network_urls();
|
||||
|
||||
if (array_key_exists($network, $networkurls)) {
|
||||
return str_replace('%%DATA%%', $this->data, $networkurls[$network]);
|
||||
$pattern = ['%%ENCODED%%', '%%PLAIN%%'];
|
||||
$data = [rawurlencode($this->data), $this->data];
|
||||
return str_replace($pattern, $data, $networkurls[$network]);
|
||||
}
|
||||
|
||||
return $this->data;
|
||||
|
Loading…
x
Reference in New Issue
Block a user