mirror of
https://github.com/getgrav/grav.git
synced 2026-05-06 15:57:14 +02:00
Added more randomization to safe_email twig filter #998
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
* Added `@page.modular` Collection type [#988](https://github.com/getgrav/grav/issues/988)
|
||||
* Added support for `self@`, `page@`, `taxonomy@`, `root@` Collection syntax for cleaner YAML compatibility
|
||||
* Improved GPM commands to allow for `-y` to automate **yes** responses and `-o` for **update** and **selfupgrade** to overwrite installations [#985](https://github.com/getgrav/grav/issues/985)
|
||||
* Added randomization to `safe_email` Twig filter [#998](https://github.com/getgrav/grav/issues/998)
|
||||
1. [](#bugfix)
|
||||
* Fix for lightbox media function throwing error [#981](https://github.com/getgrav/grav/issues/981)
|
||||
* Removed 307 redirect code option as it is not well supported [#743](https://github.com/getgrav/grav-plugin-admin/issues/743)
|
||||
|
||||
@@ -142,12 +142,16 @@ class TwigExtension extends \Twig_Extension
|
||||
public function safeEmailFilter($str)
|
||||
{
|
||||
$email = '';
|
||||
$str_len = strlen($str);
|
||||
for ($i = 0; $i < $str_len; $i++) {
|
||||
$email .= "&#" . ord($str[$i]) . ";";
|
||||
for ( $i = 0, $len = strlen( $str ); $i < $len; $i++ ) {
|
||||
$j = rand( 0, 1);
|
||||
if ( $j == 0 ) {
|
||||
$email .= '&#' . ord( $str[$i] ) . ';';
|
||||
} elseif ( $j == 1 ) {
|
||||
$email .= $str[$i];
|
||||
}
|
||||
}
|
||||
|
||||
return $email;
|
||||
return str_replace( '@', '@', $email );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user