• PHP
Lim_Email_Encoder – Email Encoder PHP Class

A PHP class for the encoder emails Lim_Email_Encoder class. This class is also used for the Email Encoder Form in WordPress plugin Email Encoder Bundle.

Example:

 <?php

$encoder = new Lim_Email_Encoder;

// set the encode method
$encoder->set_method( 'lim_email_escape' );

// create an encoded mailto link
$enc_email_link = $encoder->encode( 'info @ domain.com', 'Email Me!' );

echo $enc_email_link;

?> 

For programmers: Add your own encode method

You can easily encode your own method to add a PHP file in the folder “/methods” add. The PHP code looks like this:

 <?php
if ( ! function_exists( 'lim_email_custom' ) ):

// Info (optional)
$lim_email_custom = array(
	'name' => 'Name of Method',
	'description' => 'Description of your encode method.',
);

/**
 * @package Lim_Email_Encoder
 * @param string $email  the email to encode
 * @param string $display  the display showing on the page
 * @return string
 */
function lim_email_custom( $email, $display ) {
	// default encoding display, could replace this with your own method
	$display = Lim_Email_Encoder::get_htmlent( $display ); 

	//put your code here

	// return encode mailto link
}

endif;

?> 

Download

License

Code falls under the MIT License.

Related Articles

No comments yet.

Send your comment

  • RSS
  • LinkedIn
  • Twitter