Exemplo n.º 1
0
 function replace_plaintext($matches)
 {
     if ($this->options['replace_link_with'] == "" && $this->options['replace_title_with'] == "") {
         // find plain text emails and hide them
         $html = recaptcha_mailhide_html($this->options['public_key'], $this->options['private_key'], $matches[0]);
     } else {
         // replace both things
         if ($this->options['replace_link_with'] != "" && $this->options['replace_title_with'] != "") {
             $url = recaptcha_mailhide_url($this->options['public_key'], $this->options['private_key'], $matches[0]);
             $html = "<a href='" . htmlentities($url, ENT_QUOTES) . "' onclick=\"window.open('" . htmlentities($url, ENT_QUOTES) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"" . $this->options['replace_title_with'] . "\">" . $this->options['replace_link_with'] . "</a>";
         } else {
             if ($this->options['replace_link_with'] != "" && $this->options['replace_title_with'] == "") {
                 $url = recaptcha_mailhide_url($this->options['public_key'], $this->options['private_key'], $matches[0]);
                 $html = "<a href='" . htmlentities($url, ENT_QUOTES) . "' onclick=\"window.open('" . htmlentities($url, ENT_QUOTES) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">" . $this->options['replace_link_with'] . "</a>";
             } else {
                 if ($this->options['replace_link_with'] == "" && $this->options['replace_title_with'] != "") {
                     $url = recaptcha_mailhide_url($this->options['public_key'], $this->options['private_key'], $matches[0]);
                     $emailparts = _recaptcha_mailhide_email_parts($matches[0]);
                     $html = htmlentities($emailparts[0], ENT_QUOTES) . "<a href='" . htmlentities($url, ENT_QUOTES) . "' onclick=\"window.open('" . htmlentities($url, ENT_QUOTES) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"" . $recaptcha_opt['replace_title_with'] . "\">...</a>@" . htmlentities($emailparts[0], ENT_QUOTES);
                 }
             }
         }
     }
     // style it
     $html = '<span class="mh-email">' . $html . "</span>";
     return $html;
 }
Exemplo n.º 2
0
/**
 * Gets html to display an email address given a public an private key.
 * to get a key, go to:
 *
 * http://www.google.com/recaptcha/mailhide/apikey
 */
function recaptcha_mailhide_html($pubkey, $privkey, $email)
{
    $emailparts = _recaptcha_mailhide_email_parts($email);
    $url = recaptcha_mailhide_url($pubkey, $privkey, $email);
    return htmlentities($emailparts[0]) . "<a href='" . htmlentities($url) . "' onclick=\"window.open('" . htmlentities($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities($emailparts[1]);
}
Exemplo n.º 3
0
/**
 * Gets html to display an email address given a public an private key.
 * to get a key, go to:
 *
 * http://www.google.com/recaptcha/mailhide/apikey
 */
function recaptcha_mailhide_html($pubkey, $privkey, $email)
{
    if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
        return "To use reCAPTCHA Mailhide, you have to sign up for a public and private key, you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>";
    }
    if (!function_exists("mcrypt_encrypt")) {
        return "To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.";
    }
    $emailparts = _recaptcha_mailhide_email_parts($email);
    $url = recaptcha_mailhide_url($pubkey, $privkey, $email);
    return htmlentities($emailparts[0]) . "<a href='" . htmlentities($url) . "' onclick=\"window.open('" . htmlentities($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities($emailparts[1]);
}
Exemplo n.º 4
0
/**
 * Gets html to display an email address given a public an private key.
 * to get a key, go to:
 *
 * http://mailhide.recaptcha.net/apikey
 */
function recaptcha_mailhide_html($pubkey, $privkey, $email, $html) {
	
	// pro memoria : $html = array($id, $title, $target, $classification, $hreflang, $content);
	if(strlen($html[0]) > 0) 
	{
		$id = $html[0];
	}
	$title = 'Reveal this e-mail address';
	if(strlen($html[1]) > 0) 
	{
		$title = $html[1];
	}
		
	if(strlen($html[2]) > 0) 
	{
		$target = $html[2];
	}
	
	if(strlen($html[3]) > 0) 
	{
		$cssclass = $html[3];
	}
	
	if(strlen($html[4]) > 0) 
	{
		$hreflang = $html[4];
	}
	
	if(strlen($html[5]) > 0) 
	{
		$content = $html[5];
	}		

	$url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
	
	if( !filter_var($content, FILTER_VALIDATE_EMAIL)) // using php >= 5.2, makes sure it's not an email 
	{		
		$parts[0] = $content; // raw link label from content text
		$html = '';
	} 
	else 
	{
		$parts = _recaptcha_mailhide_email_parts ($email);
		$html = htmlentities($parts[0]);
	}	
	
	$html .= "<a ";
	if(isset($id))
	{
		$html .= "id='" . $id . "' "; 
	}
	if(isset($cssclass))
	{
		$html .= "class='" . $cssclass . "' "; 
	}
	if(isset($target))
	{
		$html .= "target='" . $target . "' "; 
	}
	if(isset($hreflang))
	{
		$html .= "hreflang='" . $hreflang . "' ";
	}
	$html .= "href='" . htmlentities ($url). "' ";
	$html .= "onclick=\"window.open('" . htmlentities ($url) . "', '', ";
	$html .= "'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" ";
	
	// if link label is an email
	if(count($parts) > 1)
	{
		$html .= "title=\"" . $title . "\">...</a>";
		$html .= '@' . htmlentities ($parts[1]);
	}
	else 
	{
		$html .= "title=\"" . $title . "\">". $parts[0] . "</a>"; // raw link label from content text 	
	}
	return $html;

}
Exemplo n.º 5
0
<?php
/**
 * Gets html to display an email address given a public an private key.
 * to get a key, go to:
 *
 * http://mailhide.recaptcha.net/apikey
 */
function recaptcha_mailhide_html($pubkey, $privkey, $email)
{
    $emailparts = _recaptcha_mailhide_email_parts($email);
    $url = recaptcha_mailhide_url($pubkey, $privkey, $email);
    return htmlentities($emailparts[0]) . '<a href="' . htmlentities($url) . '" onclick="window.open("' . htmlentities($url) . '", "", "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300"); return false;" title="Reveal this e-mail address">...</a>@' . htmlentities($emailparts[1]);
}