Latest release: 2.0.0

Latte - email helper/filter

Small Latte helper/filter based on Smarty idea to protect your email address.


Build Status Code coverage Licence

Downloads this Month Downloads total Latest stable

Discussion / Help

Join the chat

Install

composer require contributte/latte-email
1

Versions

State Version Branch PHP
stable ~2.0.0 master >= 5.6
stable ~1.2.1 master >= 5.4 (old namespace)

Overview

Encodings

  • javascript
  • javascript_charcode
  • hex
  • drupal
  • texy

Usage

{var $mail = "my@email.net"}

{$mail|email:"javascript"}
{$mail|email:"javascript_charcode"}
{$mail|email:"hex"|noescape}
{$mail|email:"javascript":"link to my email here"}
{$mail|email:"drupal"}
{$mail|email:"texy"}
1
2
3
4
5
6
7
8

Install

Config

services:
    nette.latteFactory:
        setup:
            - addFilter('email', 'Contributte\Latte\Helpers\EmailHelper::mailto')
            # or
            - addFilter('email', ['Contributte\Latte\Helpers\EmailHelper', 'mailto'])
1
2
3
4
5
6

Presenter/Control

public function createTemplate() 
{
    $template = parent::createTemplate();
    $template->addFilter('email', ['Contributte\Latte\Helpers\EmailHelper', 'mailto']);
}
1
2
3
4
5

TemplateFactory


use Nette\Application\UI\Control;
use Nette\Bridges\ApplicationLatte\Template;

final class TemplateFactory extends Nette\Bridges\ApplicationLatte\TemplateFactory
{
    /**
     * @param Control $control
     * @return Template
     */
    public function createTemplate(Control $control = NULL)
    {
        $template = parent::createTemplate($control);
        $template->addFilter('email', ['Contributte\Latte\Helpers\EmailHelper', 'mailto']);
        return $template;
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

Maintainers


Milan Felix Šulc

Thank you for testing, reporting and contributing.