Skip to content

Commit

Permalink
Create EEL Helpers to provide MailObfuscator functions in Fusion
Browse files Browse the repository at this point in the history
  • Loading branch information
paavo authored May 31, 2023
1 parent 2701e93 commit ab376c5
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions Classes/Eel/MailObfuscator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace Networkteam\Neos\MailObfuscator\Eel;

use Neos\Eel\ProtectedContextAwareInterface;
use Networkteam\Neos\MailObfuscator\Converter\Mailto2HrefObfuscatingConverter;
use Networkteam\Neos\MailObfuscator\Converter\RewriteAtCharConverter;

/**
* Eel helpers to provide MailObfuscator functions
*/
class MailObfuscator extends RewriteAtCharConverter implements ProtectedContextAwareInterface {

/**
* Convert at Character
*
* @param $email string
* @return string
*/
public function convertAtChar($email = false) {
return $this->convert($email);
}

/**
* Convert Mailto to Href
*
* @param $email string
* @return string
*/
public function convertMailto2Href($email = false) {
return (new Mailto2HrefObfuscatingConverter())->convert($email);
}

/**
* All methods are considered safe
*
* @param string $methodName
* @return boolean
*/
public function allowsCallOfMethod($methodName) {
return true;
}
}

0 comments on commit ab376c5

Please sign in to comment.