TYPO3 CMS  TYPO3_6-2
EmailViewHelper.php
Go to the documentation of this file.
1 <?php
3 
4 /* *
5  * This script is part of the TYPO3 project - inspiring people to share! *
6  * *
7  * TYPO3 is free software; you can redistribute it and/or modify it under *
8  * the terms of the GNU General Public License version 2 as published by *
9  * the Free Software Foundation. *
10  * *
11  * This script is distributed in the hope that it will be useful, but *
12  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
13  * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
14  * Public License for more details. *
15  * */
38 
42  protected $tagName = 'a';
43 
49  public function initializeArguments() {
51  $this->registerTagAttribute('name', 'string', 'Specifies the name of an anchor');
52  $this->registerTagAttribute('rel', 'string', 'Specifies the relationship between the current document and the linked document');
53  $this->registerTagAttribute('rev', 'string', 'Specifies the relationship between the linked document and the current document');
54  $this->registerTagAttribute('target', 'string', 'Specifies where to open the linked document');
55  }
56 
61  public function render($email) {
62  if ($this->isFrontendAvailable()) {
63  list($linkHref, $linkText) = $GLOBALS['TSFE']->cObj->getMailTo($email, '');
64  $escapeSpecialCharacters = !isset($GLOBALS['TSFE']->spamProtectEmailAddresses) || $GLOBALS['TSFE']->spamProtectEmailAddresses !== 'ascii';
65  } else {
66  $linkHref = 'mailto:' . $email;
67  $linkText = htmlspecialchars($email);
68  $escapeSpecialCharacters = true;
69  }
70  $tagContent = $this->renderChildren();
71  if ($tagContent !== null) {
72  $linkText = $tagContent;
73  }
74  $this->tag->setContent($linkText);
75  $this->tag->addAttribute('href', $linkHref, $escapeSpecialCharacters);
76  $this->tag->forceClosingTag(true);
77  return $this->tag->render();
78  }
79 
83  protected function isFrontendAvailable() {
84  return TYPO3_MODE === 'FE';
85  }
86 
87 }
registerTagAttribute($name, $type, $description, $required=FALSE, $default=NULL)
const TYPO3_MODE
Definition: init.php:40
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]