TYPO3 API  SVNRelease
EmailViewHelper.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*                                                                        *
00004  * This script is part of the TYPO3 project - inspiring people to share!  *
00005  *                                                                        *
00006  * TYPO3 is free software; you can redistribute it and/or modify it under *
00007  * the terms of the GNU General Public License version 2 as published by  *
00008  * the Free Software Foundation.                                          *
00009  *                                                                        *
00010  * This script is distributed in the hope that it will be useful, but     *
00011  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
00012  * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General      *
00013  * Public License for more details.                                       *
00014  *                                                                        */
00015 
00016 /**
00017  * Email URI view helper.
00018  * Generates an email URI incorporating TYPO3s spamProtectEmailAddresses-settings.
00019  *
00020  * = Examples
00021  *
00022  * <code title="basic email URI">
00023  * <f:uri.email email="foo@bar.tld" />
00024  * </code>
00025  * <output>
00026  * javascript:linkTo_UnCryptMailto('ocknvq,hqqBdct0vnf');
00027  * (depending on your spamProtectEmailAddresses-settings)
00028  * </output>
00029  *
00030  */
00031 class Tx_Fluid_ViewHelpers_Uri_EmailViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
00032 
00033     /**
00034      * @param string $email The email address to be turned into a URI
00035      * @return string Rendered email link
00036      * @author Bastian Waidelich <bastian@typo3.org>
00037      */
00038     public function render($email) {
00039         if (TYPO3_MODE === 'FE') {
00040             $emailParts = $GLOBALS['TSFE']->cObj->getMailTo($email, $email);
00041             return reset($emailParts);
00042         } else {
00043             return 'mailto:' . $email;
00044         }
00045     }
00046 }
00047 
00048 
00049 ?>