<?php
/**
* @package Joomla.Platform
* @subpackage HTML
*
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* Utility class for cloaking email addresses
*
* @package Joomla.Platform
* @subpackage HTML
* @since 11.1
*/
abstract class JHtmlEmail
{
/**
* Simple Javascript email Cloaker
*
* By default replaces an email with a mailto link with email cloaked
*
* @param string $mail The -mail address to cloak.
* @param boolean $mailto True if text and mailing address differ
* @param string $text Text for the link
* @param boolean $email True if text is an e-mail address
*
* @return string The cloaked email.
*
* @since 11.1
*/
public static function cloak($mail, $mailto = true, $text = '', $email = true)
{
// Convert text
$mail = self::_convertEncoding($mail);
// Split email by @ symbol
$mail = explode('@', $mail);
$mail_parts = explode('.', $mail[1]);
// Random number
$rand = rand(1, 100000);
$replacement = "\n <script type='text/javascript'>";
$replacement .= "\n <!--";
$replacement .= "\n var prefix = 'ma' + 'il' + 'to';";
$replacement .= "\n var path = 'hr' + 'ef' + '=';";
$replacement .= "\n var addy" . $rand . " = '" . @$mail[0] . "' + '@';";
$replacement .= "\n addy" . $rand . " = addy" . $rand . " + '" . implode("' + '.' + '", $mail_parts) . "';";
if ($mailto)
{
// Special handling when mail text is different from mail address
if ($text)
{
if ($email)
{
// Convert text
$text = self::_convertEncoding($text);
// Split email by @ symbol
$text = explode('@', $text);
$text_parts = explode('.', $text[1]);
$replacement .= "\n var addy_text" . $rand . " = '" . @$text[0] . "' + '@' + '" . implode("' + '.' + '", @$text_parts)
. "';";
}
else
{
$replacement .= "\n var addy_text" . $rand . " = '" . $text . "';";
}
$replacement .= "\n document.write('<a ' + path + '\'' + prefix + ':' + addy" . $rand . " + '\'>');";
$replacement .= "\n document.write(addy_text" . $rand . ");";
$replacement .= "\n document.write('<\/a>');";
}
else
{
$replacement .= "\n document.write('<a ' + path + '\'' + prefix + ':' + addy" . $rand . " + '\'>');";
$replacement .= "\n document.write(addy" . $rand . ");";
$replacement .= "\n document.write('<\/a>');";
}
}
else
{
$replacement .= "\n document.write(addy" . $rand . ");";
}
$replacement .= "\n //-->";
$replacement .= '\n </script>';
// XHTML compliance no Javascript text handling
$replacement .= "<script type='text/javascript'>";
$replacement .= "\n <!--";
$replacement .= "\n document.write('<span style=\'display: none;\'>');";
$replacement .= "\n //-->";
$replacement .= "\n </script>";
$replacement .= JText::_('JLIB_HTML_CLOAKING');
$replacement .= "\n <script type='text/javascript'>";
$replacement .= "\n <!--";
$replacement .= "\n document.write('</');";
$replacement .= "\n document.write('span>');";
$replacement .= "\n //-->";
$replacement .= "\n </script>";
return $replacement;
}
/**
* Convert encoded text
*
* @param string $text Text to convert
*
* @return string The converted text.
*
* @since 11.1
*/
protected static function _convertEncoding($text)
{
// Replace vowels with character encoding
$text = str_replace('a', 'a', $text);
$text = str_replace('e', 'e', $text);
$text = str_replace('i', 'i', $text);
$text = str_replace('o', 'o', $text);
$text = str_replace('u', 'u', $text);
return $text;
}
}
| nama | waktu | ukuran | owner | perm | aksi |
|---|---|---|---|---|---|
| .. | |||||
| access.php | 2014-04-14 20:06 | 9.02 KB | 76129f60960:kunden | -xw-x----- | |
| batch.php | 2014-04-14 20:07 | 4.09 KB | 76129f60960:kunden | -xw-x----- | |
| behavior.php | 2014-04-14 20:06 | 32.69 KB | 76129f60960:kunden | -xw-x----- | |
| category.php | 2014-04-14 20:07 | 4.04 KB | 76129f60960:kunden | -xw-x----- | |
| content.php | 2014-04-14 20:07 | 1.17 KB | 76129f60960:kunden | -xw-x----- | |
| contentlanguage.php | 2014-04-14 20:06 | 1.66 KB | 76129f60960:kunden | -xw-x----- | |
| date.php | 2014-04-14 20:07 | 1.99 KB | 76129f60960:kunden | -xw-x----- | |
| email.php | 2014-04-14 20:06 | 3.72 KB | 76129f60960:kunden | -xw-x----- | |
| form.php | 2014-04-14 20:06 | 791 B | 76129f60960:kunden | -xw-x----- | |
| grid.php | 2014-04-14 20:06 | 10.36 KB | 76129f60960:kunden | -xw-x----- | |
| image.php | 2014-04-14 20:06 | 5.08 KB | 76129f60960:kunden | -xw-x----- | |
| index.html | 2014-04-14 20:07 | 31 B | 76129f60960:kunden | -xw-x----- | |
| jgrid.php | 2014-04-14 20:06 | 16.35 KB | 76129f60960:kunden | -xw-x----- | |
| list.php | 2014-04-14 20:07 | 9.65 KB | 76129f60960:kunden | -xw-x----- | |
| menu.php | 2014-04-14 20:07 | 8.6 KB | 76129f60960:kunden | -xw-x----- | |
| number.php | 2014-04-14 20:06 | 1.58 KB | 76129f60960:kunden | -xw-x----- | |
| rules.php | 2014-04-14 20:07 | 7.96 KB | 76129f60960:kunden | -xw-x----- | |
| select.php | 2014-04-14 20:06 | 24.96 KB | 76129f60960:kunden | -xw-x----- | |
| sliders.php | 2014-04-14 20:06 | 3.99 KB | 76129f60960:kunden | -xw-x----- | |
| string.php | 2014-04-14 20:06 | 4.5 KB | 76129f60960:kunden | -xw-x----- | |
| tabs.php | 2014-04-14 20:06 | 2.83 KB | 76129f60960:kunden | -xw-x----- | |
| tel.php | 2014-04-14 20:07 | 2.21 KB | 76129f60960:kunden | -xw-x----- | |
| user.php | 2014-04-14 20:06 | 2.38 KB | 76129f60960:kunden | -xw-x----- | |