Gibt den personalisierten HTML-Quelltext der Mail zurück
545337
public function getHtml(Kwc_Mail_Recipient_Interface $recipient = null, $addViewTracker = false)
    {
        $renderer = new Kwf_Component_Renderer_Mail();
        $renderer->setRenderFormat(Kwf_Component_Renderer_Mail::RENDER_HTML);
        $renderer->setRecipient($recipient);
        $renderer->setHtmlStyles($this->getHtmlStyles());
        $ret = $renderer->renderComponent($this->getData());
        Kwf_Benchmark::checkpoint('html: render');
        $ret = $this->_processPlaceholder($ret, $recipient);
        Kwf_Benchmark::checkpoint('html: placeholder');
        $redirectComponent = $this->getData()->getChildComponent('_redirect');
        if ($redirectComponent) {
            $redirectComponent = $redirectComponent->getComponent();
            $ret = $redirectComponent->replaceLinks($ret, $recipient, 'mailhtml');
        }
        Kwf_Benchmark::checkpoint('html: replaceLinks');
        if ($addViewTracker && $this->_getSetting('trackViews')) {
            $params = array();
            if ($recipient->id) $params['recipientId'] = urlencode($recipient->id);
            if ($shortcut = $redirectComponent->getRecipientModelShortcut(get_class($recipient->getModel())))
                $params['recipientModelShortcut'] = urlencode($shortcut);
            $https = Kwf_Util_Https::domainSupportsHttps($this->getData()->getDomain());
            $protocol = $https ? 'https' : 'http';
            $imgUrl = $protocol . '://'.$this->getData()->getDomain() .
                Kwf_Media::getUrl($this->getData()->componentClass, $this->getData()->componentId,
                    'views', 'blank.gif');
            $imgUrl .= '?' . http_build_query($params);
            $ret .= '<img src="' . $imgUrl . '" width="1" height="1" />';
            Kwf_Benchmark::checkpoint('html: view tracker');
        }
        $ret = ltrim($this->_getSetting('docType')."\n".$ret);
        return $ret;
    }
110533
def replace_and_send_mail_safely(mail, recipient)
      html_body = mail.html_part.body.raw_source
      do_custom_replacements_for(mail, recipient)
      send_raw_email_safely(mail)
      mail.html_part.body = html_body
    end
444990
public function setMeta($name, $content = NULL, $httpEquiv = FALSE, $scheme = NULL) {
    $meta = HTML::Tag('meta');
    $meta->setOption('selfClosing',TRUE);

    if ($content === NULL) {
      /* löschen */
      $this->removeMeta($name);
    
    } else {
      /* im W3C steht "may be used in place" ... d.h. man könnte auch name und http-equiv gleichzeitig benutzen 
         http://www.w3.org/TR/html4/struct/global.html#edef-META
      */

      if (isset($name)) {
        if (!$httpEquiv) 
          $meta->setAttribute('name',$name);
        else
          $meta->setAttribute('http-equiv',$name);
      }
  
      if (isset($scheme))
        $meta->setAttribute('scheme',$scheme);

      if ($content !== FALSE) {
        $meta->setAttribute('content',$content);
      }

      /* meta tags liegen im head in der root ebene, d.h. wir suchen ob es dort schon ein meta tag gibt,
         wenn es eins gibt ersetzen wir dies, ansonsten fügen wir es hinzu 
      */
      /* schlüssel des meta tags suchen (wenn vorhanden) */
      $key = NULL;
      foreach ($this->head->content as $itemKey => $item) {
        if ($item instanceof Tag && $item->getTag() == 'meta' && ($item->getAttribute('name') == $name || $item->getAttribute('http-equiv') == $name)) {
          $key = $itemKey;
          break;
        }
      }
      
      if ($key !== NULL) {
        $this->head->content[$key] =& $meta;
      } else {
        $this->head->content[] =& $meta;
      }
    }
    return $meta;
  }
222881
public function BasicObfuscateEmails($html)
    {
        $reg = '/[:_a-z0-9-+]+(\.[_a-z0-9-+]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})/i';
        if (preg_match_all($reg, $html, $matches)) {
            $searchstring = $matches[0];
            for ($i=0; $i < count($searchstring); $i++) {
                $html = preg_replace(
                    '/' . $searchstring[$i] . '/',
                    $this->encode($searchstring[$i]),
                    $html
                );
            }
        }
        return $html;
    }
15828
function getOverriddenEmail(email: string): string {
  if (!cfg.email.devEmail) {
    throw new Error("Email failed to send: cfg.email.devEmail is not set");
  }
  const devEmailParts = cfg.email.devEmail.split("@");
  return `${devEmailParts[0]}+${email.replace("@", ".at.")}@${
    devEmailParts[1]
  }`;
}
709619
function initEmailForm() {
        var newsletterForm = document.getElementById('newsletter-form');
        var submitButton = document.getElementById('newsletter-submit');
        var formDetails = document.getElementById('newsletter-details');
        var emailField = document.querySelector('.mzp-js-email-field');
        var formExpanded = window.getComputedStyle(formDetails).display === 'none' ? false : true;

        function emailFormShowDetails() {
            if (!formExpanded) {
                formDetails.style.display = 'block';
                formExpanded = true;
            }
        }

        emailField.addEventListener('focus', function() {
            emailFormShowDetails();
        });

        submitButton.addEventListener('click', function(e) {
            if (!formExpanded) {
                e.preventDefault();
                emailFormShowDetails();
            }
        });

        newsletterForm.addEventListener('submit', function(e) {
            if (!formExpanded) {
                e.preventDefault();
                emailFormShowDetails();
            }
        });
    }
369741
function metaData( $contentObjectAttribute )
    {
        $metaString = "";
        $user = $contentObjectAttribute->content();

        if ( $user instanceof eZUser )
        {
            // create a default user account
            $metaString .= $user->attribute( 'login' ) . " ";
            $metaString .= $user->attribute( 'email' ) . " ";
        }
        return $metaString;
    }
199463
public function php() {
    $cr = "\n";
    
    $php = $this->phpDocBlock(0);
    
    $ms = array(self::MODIFIER_ABSTRACT => 'abstract',
                self::MODIFIER_FINAL => 'final'
               );
    
    foreach ($ms as $const => $modifier) {
      if (($const & $this->modifiers) == $const)
        $php .= $modifier.' ';
    }
    
    $php .= 'class '.$this->getClassName().' ';
    
    /* Extends */
    if (isset($this->parentClass)) {
      if ($this->parentClass->getNamespace() === $this->getNamespace()) {
        $php .= 'extends '.$this->parentClass->getClassName().' '; // don't prefix namespace
      } else {
        $php .= 'extends '.'\\'.$this->parentClass->getFQN().' ';
      }
    }
    
    /* Interfaces */
    if (count($this->getInterfaces()) > 0) {
      $php .= 'implements ';
      $that = $this;
      $php .= A::implode($this->getInterfaces(), ', ', function (GClass $iClass) use ($that) {
        if ($that->getNamespace() === $iClass->getNamespace()) {
          return $iClass->getClassName();
        } else {
          return '\\'.$iClass->getFQN();
        }
      });
      $php .= ' ';
    }
    
    $php .= '{'.$cr;
    /* Die Funktionen machen immer den Abstand nach oben. Also vor jedem Property und jeder Methode macht dies ein "\n" */

    /* Constants */
    $php .= A::joinc($this->getConstants(), '  '.$cr.'%s;'.$cr, function ($constant) {
      return $constant->php(2);
    });
    
    /* Properties */
    $php .= A::joinc($this->getProperties(), '  '.$cr.'%s;'.$cr, function ($property) {
      return $property->php(2); // hier jetzt auch wegen DocBlock einrücken
    });

    /* Methods */
    $php .= A::joinc($this->getMethods(), '  '.$cr.'%s'.$cr, function ($method) {
      return $method->php(2); // rückt selbst zwischen den Klammern ein, aber wir wollen ja den body z.b. auf 4 haben nicht auf 2
    });
    
    $php .= '}'; // kein umbruch hinten, immer abstand nach oben!
    return $php;
  }
1192998
function getEmailIfValid(emailToVerify) {
  if (emailToVerify) {
    const email = emailToVerify.trim();
    if (emailRegex.test(email)) {
      return email;
    } else {
      return undefined;
    }
  }
}
405082
public static function docPart($htmlPart, $encoding = 'utf-8', $docType = NULL) {
    if (!is_string($htmlPart))
      $htmlPart = self::export($htmlPart);
    
    if (mb_strpos(trim($htmlPart), '<!DOCTYPE') === 0) {
      $document = $htmlPart;
    } else {
      // DOMDocument setzt so oder so einen default, also können wir das auch explizit machen
      $docType = $docType ?: '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';

      // ebenso das encoding ist utf8
      $document  = $docType."\n";
      
      if (mb_strpos(trim($htmlPart),'<html') === 0) {
        $document .= $htmlPart;
      } else {
        $document .= '<html><head><meta http-equiv="Content-Type" content="text/html; charset='.$encoding.'"/></head><body>'.$htmlPart.'</body></html>';
      }
    }
    
    return self::doc($document);
  }
468708
function html()
	{
		$params = $this->params();

		if(!empty($params['property']))
			$params['name'] = $params['property'];

		$form = $this->form();

		extract($params);

		$obj = $form->object();
		if(!$obj)
			$obj = $form->call('calling_object');

		$el_params = "";
		foreach(explode(' ', 'size style') as $p)
			if(!empty($$p))
				$el_params .= " $p=\"{$$p}\"";

		if(!empty($xref))
		{
			// Задан класс m2m связей
			if(is_object($xref))
				$xref_obj = $xref;
			else
				$xref_obj = bors_foo($xref);

			$list = $xref_obj->named_list($obj);
			$name = $xref_obj->name($obj, $xref_obj->class_name());
		}

		// http://admin2.aviaport.wrk.ru/newses/256783/form2/
		if(!empty($named_list))
			$list = bors_foo($named_list)->named_list();

		if(!is_array($list))
		{
			if(preg_match("!^(\w+)\->(\w+)$!", $list, $m))
			{
				if($m[1] == 'this')
					$list = call_user_func([$obj, $m[2]]);
				else
					$list = call_user_func([bors_foo($m[1]), $m[2]]);
			}
			elseif(preg_match("!^(\w+)\->(\w+)\('(.+)'\)!", $list, $m))
			{
				if($m[1] == 'this')
					$list = call_user_func([$obj, $m[2]], $m[3]);
				else
					$list = call_user_func([bors_foo($m[1]), $m[2]], $m[3]);
			}
			elseif(preg_match("!^\w+$!", $list))
			{
				$list_class = $list;
				$list = new $list_class(@$args);
				$list = $list->get('named_list');
				if(!$list)
					$list = base_list::make($list_class, array(), $params + array('non_empty' => true));
			}
			else
			{
				eval('$list='.$list);
			}
		}

		if(!$current && !empty($list['default']))
			$current = $list['default'];

		if(empty($delim))
			$delim = "<br />";

		$ids = array();

		$values = $value;

		if(empty($values))
		{
			if(empty($get))
				$current = preg_match('!^\w+$!', $name) ? (isset($value)?$value:($obj?$obj->get($name):0)) : 0;
			else
				$current = $obj->$get();

			if(!$current && !empty($list['default']))
				$current = $list['default'];

			if(!is_array($current))
				$current = array($current);
		}
		else
			$current = $values;

		$class = explode(' ', defval($params, 'class'));

		if(in_array($name, explode(',', session_var('error_fields'))))
			$class[] = "error";

		if($class)
			$class = ' class="'.join(' ', $class).'"';
		else
			$class = '';

		$label_css = explode(' ', defval($params, 'label_css', ''));

		if(in_array($name, explode(',', session_var('error_fields'))))
			$label_css[] = "error";

		if(!empty($label_css))
			$label_css = " class=\"".join(" ", $label_css)."\"";
		else
			$label_css = "";

		if($input_data_toggle = defval($params, 'input_data_toggle', ''))
			$input_data_toggle = " data-toggle=\"$input_data_toggle\"";

		$html = '';

		// Если нужно, добавляем заголовок поля
		$html .= $this->label_html();

		// Если отдельный блок, то на всю ширину.
		if($this->label() && empty($style))
			$style = "width: 99%";

		$labels_html = array();

		if($columns)
		{
			$labels_html[] = "<table><tr><td style=\"padding: 0 10px 0 0\">";
			$per_column = ceil(count($list) / $columns);
		}

		$pos = 0;

		foreach($list as $id => $iname)
		{
			if($columns && $pos && $pos % $per_column == 0)
				$labels_html[] = "</td><td>";

			$ids[] = $id;
			$checked = in_array($id, $current);
			$labels_html[] = "<label{$label_css}><input type=\"checkbox\" name=\"".addslashes($name)."[]\" value=\"$id\"".($checked ? " checked=\"checked\"" : "")."$el_params$class$input_data_toggle />".($checked?'<b>':'')."&nbsp;$iname".($checked?'</b>':'')."</label>$delim\n";
			$pos++;

		}

		if($columns)
			$labels_html[] = "</td></tr></table>";

		$labels_html = join("", $labels_html);

		if($container = defval($params, 'label_container'))
			$labels_html = sprintf($container, $labels_html);

		$html .= $labels_html;

		$form->append_attr('checkboxes_list', $name);

		if($form->get('has_form_table'))
			$html .= "</td></tr>\n";

		return $html;
	}
716722
private MailContent tag(String tag, String atributs) {
        ends.push("</" + tag + ">");
        html.a('<').a(tag).sp().a(atributs).a('>');
        return this;
    }
527239
public function template($input)
    {
        //buforowanie renderowanie szablonu
        $input = preg_replace_callback('/\{\'([a-zA-Z\-\/]+)\'\}/', [&$this, '_render'], $input);

        /**
         * obsługa klamr
         * obsługa zakończeń linii windows
         * komentarzy
         */
        $input = str_replace([
            '{{$',
            '{{',
            '}}',
            "\r\n",
            '{*',
            '*}',
        ], [
            '__-angular-controller-__',
            '__-angular-start-__',
            '__-angular-end-__',
            "\n",
            '<?php /*',
            '*/ ?>',
        ], $input);

        //buforowanie linkowanie aplikacji
        $input = preg_replace_callback('/\{@([\*]+)?(.[^@\^]+)?[\^]?(.[^@\^]+)?@\}/', [&$this, '_url'], $input);

        //zmiana zmiennych obiektowych w linkach np. $request->test
        $input = preg_replace_callback('/%7B((%3E|%28|%29|%24)?([a-zA-Z\.\-\_\[\]\'\"\(\)]+)?)+%7D/', [&$this, '_routerLinks'], $input);

        //zmiana zmiennych skalarnych lub tablicowych w linkach np. $requestTest
        $input = preg_replace('/%7B%24([a-z0-9A-Z\.\-\_\[\]\'\"\(\)]+)%7D/', '{$$1}', $input);

        //buforowanie tłumaczeń
        $input = preg_replace_callback('/\{\#(.[^#]+)#\}/', [&$this, '_translate'], $input);

        //buforowanie wstawień tekstów statycznych
        $input = preg_replace_callback('/\{\=(.[^=]+)\=\}/', [&$this, '_text'], $input);

        //filtry na zmiennych (filtry widoku)
        $input = preg_replace_callback('/(\$[a-z0-9_\[\]\'\"\-\>]+)(\|(.[^}^{^)^(]+))+/i', [&$this, '_filter'], $input);

        //obsługa tagów Mmi
        $input = preg_replace([
            '/\$([a-z0-9_-]+)/i', //$zmienna -> $this->zmienna
            '/\{\/(if|for|foreach|while)\}/', //końcówki struktur językowych
            '/\{(break|continue)\}/', //break continue
            '/\{return\}/', //wyjście
            '/\{(if|elseif|foreach|for|while)([^\}]+)\}/', //struktury językowe
            '/([a-z0-9_-]+)\(/i', //funkcja( -> $this->funkcja(
            '/\$this->(array)\(/', //naprawianie array
            '/\$this->([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)/i', //tabele po kropce
            '/\$this->([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)/i', //tabele po kropce
            '/\$this->([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)/i', //tabele po kropce
            '/\->\$this->/', //naprawianie metod
            '/\:\:\$this->/', //naprawianie staticów
            '/\{else\}/', //else
            '/\{\$this->([a-z0-9_-]+)([\s]?\=)/i', //przypisanie wartości do zmiennej
            '/\{\$this->([a-z0-9_-]+)([\s]?\+\=|\-\=|\+\+|\-\-|\*\=)/i', //przypisanie wartości do zmiennej
            '/\{\$this->([a-z0-9_-]+)/i', //wyświetlanie pól
            '/\{\$this->php_([a-z0-9_-]+)\(/i', //wyświetlanie funkcji php
            '/\$this->php_([a-z0-9_-]+)\(/i', //zamiana na funkcje php wbudowane
            '/\{\$this->system_([a-z0-9_-]+)\(/i', //wyświetlanie funkcji php
            '/\$this->system_([a-z0-9_-]+)\(/i', //zamiana na funkcje php wbudowane
            '/\{\$this->([a-z0-9_-]+)\(/i', //wyświetlanie helperów
            '/([a-z0-9)\]\'\+\-])}/i', //obsługa zamknięcia
            '/\{\$\$this->([a-z0-9_-]+)/i', //$nazwa -> $this->{$this->nazwa}
        ], [
            '$this->${1}',
            '<?php end${1}; ?>',
            '<?php ${1}; ?>',
            '<?php return; ?>',
            '<?php ${1} (${2}): ?>',
            '$this->${1}(',
            '${1}(',
            '$this->${1}[\'${2}\'][\'${3}\'][\'${4}\']',
            '$this->${1}[\'${2}\'][\'${3}\']',
            '$this->${1}[\'${2}\']',
            '->',
            '::$',
            '<?php else: ?>',
            '<?php \$this->${1} ${2} ',
            '<?php \$this->${1}${2}',
            '<?php echo \$this->${1}',
            '<?php echo ${1}(',
            '${1}(',
            '<?php echo ${1}(',
            '${1}(',
            '<?php echo \$this->${1}(',
            '${1}; ?>',
            '<?php echo \$this->{$this->${1}}',
        ], $input);

        /**
         * first i last w pętlach foreach
         * uwaga: source i count są zmiennymi lokalnymi niewidocznymi z poziomu view
         */
        $input = preg_replace([
            '/\<\?php foreach[\s]+?\([\s]+?name=[\'\"]?([a-z0-9]+)[\'\"]? (\$this[\>\(\)a-z0-9_\-\[\]\'\"]+) as (\$this->[a-z0-9_\-]+)\):/i',
            '/\<\?php foreach[\s]+?\([\s]+?name=[\'\"]?([a-z0-9]+)[\'\"]? (\$this[\>\(\)a-z0-9_\-\[\]\'\"]+) as (\$this->[a-z0-9_\-]+) => (\$this->[a-z0-9_\-]+)\):/i'
        ], [
            '<?php $_${1}Source = ${2}; $_${1}Count = count((array)$_${1}Source); $this->_${1}Index = 0; foreach ( $_${1}Source as ${3}): $this->_${1}Index++; $this->_${1}First = false; $this->_${1}Last = false; if ($this->_${1}Index == 1) { $this->_${1}First = true; } else { $this->_${1}First = false; } if ($this->_${1}Index == $_${1}Count) { $this->_${1}Last = true; } else { $this->_${1}Last = false; } if($this->_${1}Index % 2 == 0) { $this->_${1}Even = true; } else { $this->_${1}Even = false; }',
            '<?php $_${1}Source = ${2}; $_${1}Count = count((array)$_${1}Source); $this->_${1}Index = 0; foreach ( $_${1}Source as ${3} => ${4}): $this->_${1}Index++; $this->_${1}First = false; if ($this->_${1}Index == 1) { $this->_${1}First = true; } else { $this->_${1}First = false; } if ($this->_${1}Index == $_${1}Count) { $this->_${1}Last = true; } else { $this->_${1}Last = false; }'
        ], $input);

        /**
         * odzyskuje klamry
         */
        $input = str_replace([
            '__-angular-controller-__',
            '__-angular-start-__',
            '__-angular-end-__',
        ], [
            '{{$',
            '{{',
            '}}',
        ], $input);

        //fix dla funkcji JS'owych - badanie krótkich pod-ciągów
        $output = '';
        $php = false;
        for ($i = 0, $length = strlen($input); $i < $length; $i++) {
            if ($length > ($i + 5) && substr($input, $i, 5) == '<?php') {
                $php = true;
            } elseif ($length > ($i + 2) && substr($input, $i, 2) == '?>') {
                $php = false;
            }
            if (!$php && $length > ($i + 7) && substr($input, $i, 7) == '$this->') {
                $i += 7;
            }
            $output .= $input[$i];
        }
        return $output;
    }
1011850
function encodeEmail_debutpage($email, $name = null)
    {

        $email = preg_replace("/\"/", "\\\"", $email);

        if ($name == null) {
            $name = $email;
        }

        $old = "document.write('<a CLASS=infoacceuil ".
            "href=\"mailto:$email\">$name</a>')";

        $output = "";

        for ($i=0; $i < pia_strlen($old); $i++) {
            $output = $output . '%' . bin2hex(pia_substr($old, $i, 1));
        }

        $output = '<script type="text/javascript">eval(unescape(\''.
            $output.'\'))</script>';
        $output .= '<noscript><div>Vous devez accepter le Javascript'.
            ' pour voir l\'email</div></noscript>';
        return $output;
    }
682897
public function JSObfuscateEmails($html)
    {
        $this->list = ArrayList::create();
        $regex_email = '[:_a-z0-9-+]+(\.[_a-z0-9-+]+)*@[a-z0-9-]+(\.[a-z0-9]+)*(\.[a-z]{2,4})';
        $regex_attributes = "((?:\w+\s*=\s*)(?:\w+|\"[^\"]*\"|'[^']*'))*?";
        $regex_email_query = "(?:\?[A-Za-z0-9_= %\.\-\~\_\&;\!\*\(\)\'#&]*)?)";
        $regex_email_href = "href\s*=\s*(['\"])mailto:(".$regex_email.$regex_email_query."\\2";
        $whitespace = "\s*";
        $tag_regex = "/<a\s+".$regex_attributes/* 1 */.$whitespace.$regex_email_href/* 3,5,6 */.$whitespace.$regex_attributes/* 7 */.">(.*?)<\/a>/i";
        $tag_replacement = "/<a\s+".$regex_attributes/* 1 */.$whitespace.$regex_email_href/* 3,5,6 */.$whitespace.$regex_attributes/* 7 */.">(.*?)<\/a>/i";

        // First we convert all a tag Emails
        $html = preg_replace_callback($tag_regex, "self::callbackTag", $html);

        // Then we convert all plain text Emails
        $plaintext_regex = "/\b(?<!value=['\"])".$regex_email."\b(?<!['\"])/i";
        $html = preg_replace_callback($plaintext_regex, "self::callbackPlainText", $html);

        $list = array();
        foreach ($this->list as $email) {
            $list[$email->getID()] = $email->getObfuscatedEmail();
        }
        $list = Convert::array2json($list);
        $script = "<script type='text/javascript'>
        window.addEventListener('DOMContentLoaded', function(){
            var emaillist = $list;
            setTimeout(function(){
                $('a[data-obfuscate]').each(function(index){
                    var emailid = $(this).data('obfuscate'),
                        email = emaillist[emailid];
                    if(email != 'undefined') {
                        $(this).attr('href', 'mailto:' + email[1] + '@' + email[0]).attr('data-obfuscate', '');
                    }
                });
                $('span[data-obfuscate]').each(function(index){
                    var emailid = $(this).data('obfuscate'),
                        email = emaillist[emailid];
                    if(email != 'undefined') {
                        $(this).html(email[1] + '@' + email[0]);
                    }
                });
            }, 2000);
        });
        </script>";
        $html = str_ireplace('</body>', $script.'</body>', $html);
        return $html;
    }
988836
public function getPage()
    {
        $page = $this;
        if ($this->isPage) return $this;
        if (isset($this->_lazyParent)) {
            //optimierung: hier koennen eventuell ein paar nicht-pages uebersprungen werden
            $id = $this->_lazyParent;
            if (is_numeric($id) || strpos($id, '-') === false) {
                //ist eine page
            } else {
                if (strpos($id, '_') === false) {
                    $id = substr($id, 0, strpos($id, '-'));
                    if (!is_numeric($id)) {
                        return null;
                    }
                } else {
                    $underScorePos = strrpos($id, '_');
                    $hyphenPos = strpos($id, '-', $underScorePos);
                    if ($hyphenPos > $underScorePos) {
                        $id = substr($id, 0, $hyphenPos);
                    }
                }
            }
            return Kwf_Component_Data_Root::getInstance()->getComponentById($id, array('ignoreVisible'=>true));
        }
        while ($page && !$page->isPage) {
            $page = $page->parent;
        }
        return $page;
    }
980160
def Email(msg=None):
    '''
    
    '''
    def f(v):
        if re.match("[\w\.\-]*@[\w\.\-]*\.\w+", str(v)):
            return str(v)
        else:
            raise Invalid(msg or ("Endereco de email invalido"))
    return f