示例#1
0
 /**
  * Replaces the md5 hashes from dntHash with the original content
  * @param $text Text to search and replace in
  * @return string
  */
 function deHash($text)
 {
     if (!self::$store) {
         return $text;
     }
     $return = str_replace(array_keys(self::$store), self::$store, $text);
     self::$store = array();
     return $return;
 }
示例#2
0
 /**
  * Replaces all occurences of email addresses within a text 
  * that will not break the html. Addresses within form elements and
  * tags are not replaced.
  * 
  * @param string $text Text to search for emails
  * @return string The text with encrypted emails
  */
 function replace($text)
 {
     global $USER;
     if (!$text || $USER->ID !== NOBODY) {
         return $text;
     }
     $email_regexp = '([A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4})';
     $text = preg_replace_callback('#<(' . join('|', self::$DoNottouch) . ')[^>]*>.*?</\\1>#is', array('dntHash', 'mailhash'), $text);
     $text = preg_replace_callback('#\\<a[^\\>]* href="mailto:' . $email_regexp . '"(?:[^>]*?)>([^\\<]*)\\<\\/a\\>' . '#is', array('SafeEmails', 'safeEmailsHelper'), $text);
     $text = preg_replace_callback('#<([^>]*?)' . $email_regexp . '(.*)>#is', array('dntHash', 'mailhash'), $text);
     $text = preg_replace_callback('#' . $email_regexp . '#is', array('SafeEmails', 'safeEmailsHelper'), $text);
     return dntHash::deHash($text);
 }
示例#3
0
 function getPreamble($limit = false, &$clipping_occured = false)
 {
     global $CONFIG;
     /* 		if(!$limit)	$limit = ($CONFIG->News->Preamble_size ? $CONFIG->News->Preamble_size : 300); */
     return dntHash::deHash(lineTrim(strip_tags(preg_replace_callback(array('#<(a|b)[^>]*?>.*?</\\1>#i', '#<br[^>]*?>#i'), array('dntHash', 'hash'), $this->getContent('Text'))), $limit, '...', $clipping_occured));
 }