Skip to content

Commit

Permalink
Php version #3
Browse files Browse the repository at this point in the history
  • Loading branch information
FGRibreau committed Mar 4, 2013
1 parent e4ee4be commit b6cc54c
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 6 deletions.
11 changes: 9 additions & 2 deletions lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,21 @@ Generator.compile = function(fn){
var regexp = this.getEmailRegexp();
var list = loader.getList();
var listJSON = JSON.stringify(list);
var listSTR = listJSON.substring(1, listJSON.length-1);

mu.clearCache();

function iter(template, done){
this.emit('compiling:template', template);
var d = '';
this.emit('compiling:template', template);

mu
.compileAndRender(template.fullpath, {regexp:regexp, list:list, listJSON:listJSON})
.compileAndRender(template.fullpath, {
regexp:regexp,
list:list,
listSTR:listSTR,
listJSON:listJSON
})
.on('data', function(data){
d += data;
})
Expand Down
2 changes: 1 addition & 1 deletion platform/javascript/mailchecker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion platform/javascript/mailchecker.tmpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
var isValidEmail = {{& regexp }};
var isThrowableEmail = new RegExp({{& listJSON }}.join('|'));

global.mailChecker = function(email){
global.MailChecker = function(email){
if(!isValidEmail.test(email)){return false;}
return !isThrowableEmail.test(email);
};
Expand Down
2 changes: 1 addition & 1 deletion platform/node/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion platform/node/index.tmpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var lists = {{& listJSON }};
var isValidEmail = {{& regexp }};
var isThrowableEmail = new RegExp(lists.join('|'));

module.exports = function mailChecker(email){
module.exports = function MailChecker(email){
if(!isValidEmail.test(email)){return false;}
return !isThrowableEmail.test(email);
};
15 changes: 15 additions & 0 deletions platform/php/mailchecker.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
/**
* Usage
*
* include('mailchecker/platform/php/Mailchecker.php');
* MailChecker(String email);
* @return {Boolean} true is the specified email is valid, false otherwise
*/

$pattern = '/'.implode('|', array("0-mail.com","0815.ru","0clickemail.com","10minutemail.com","20minutemail.com","2prong.com","30minutemail.com","3d-painting.com","4warding.com","4warding.net","4warding.org","60minutemail.com","amilegit.com","anonbox.net","anonymbox.com","antispam.de","beefmilk.com","binkmail.com","bio-muesli.net","bobmail.info","bofthew.com","brefmail.com","bsnow.net","bugmenot.com","bumpymail.com","cosmorph.com","courrieltemporaire.com","cubiclink.com","curryworld.de","cust.in","dacoolest.com","dandikmail.com","dayrep.com","deadaddress.com","despam.it","devnullmail.com","discardmail.com","discardmail.de","disposemail.com","dispostable.com","dodgeit.com","dodgit.com","dodgit.org","donemail.ru","dontreg.com","dontsendmespam.de","dump-email.info","dumpyemail.com","e4ward.com","email60.com","emailigo.de","emailinfive.com","emailmiser.com","emailsensei.com","emailtemporario.com.br","emailwarden.com","emailx.at.hm","fakeinbox.com","fakeinformation.com","fastacura.com","filzmail.com","fizmail.com","fr33mail.info","get1mail.com","get2mail.fr","getonemail.com","getonemail.net","gishpuppy.com","great-host.in","guerillamail.com","guerrillamail.com","guerrillamailblock.com","h.mintemail.com","haltospam.com","hochsitze.com","hotpop.com","hulapla.de","ieatspam.eu","ieatspam.info","imails.info","incognitomail.com","incognitomail.net","incognitomail.org","insorg-mail.info","ipoo.org","jetable.com","jetable.net","jetable.org","jnxjn.com","junk1e.com","keepmymail.com","kir.ch.tc","klzlk.com","kulturbetrieb.info","lhsdv.com","litedrop.com","lol.ovpn.to","lookugly.com","lopl.co.cc","m4ilweb.info","mail-temporaire.fr","mail.by","mail4trash.com","mailcatch.com","maileater.com","mailexpire.com","mailin8r.com","mailinator.com","mailinator.net","mailinator2.com","mailme.ir","mailme.lv","mailmetrash.com","mailnator.com","mailnesia.com","mailnull.com","mailslite.com","mailzilla.org","mbx.cc","meltmail.com","messagebeamer.de","mierdamail.com","mintemail.com","moburl.com","monemail.fr.nf","msa.minsmail.com","mt2009.com","mypartyclip.de","myphantomemail.com","mytrashmail.com","nepwk.com","no-spam.ws","nobulk.com","noclickemail.com","nogmailspam.info","nomail2me.com","nomorespamemails.com","nospam4.us","nospamfor.us","nospamthanks.info","notmailinator.com","nowmymail.com","nus.edu.sg","nwldx.com","onewaymail.com","online.ms","ovpn.to","owlpic.com","pjjkp.com","politikerclub.de","pookmail.com","prtnx.com","qq.com","quickinbox.com","recode.me","regbypass.com","rmqkr.net","rppkn.com","rtrtr.com","s0ny.net","safe-mail.net","safetymail.info","safetypost.de","sandelf.de","saynotospams.com","selfdestructingmail.com","sendspamhere.com","sharklasers.com","shitmail.me","skeefmail.com","slopsbox.com","smellfear.com","snakemail.com","sofimail.com","sofort-mail.de","sogetthis.com","spam.la","spam.su","spamavert.com","spambob.net","spambob.org","spambog.com","spambog.de","spambog.ru","spambox.info","spambox.irishspringrealty.com","spambox.us","spamcero.com","spamday.com","spamfree24.com","spamfree24.de","spamfree24.eu","spamfree24.info","spamfree24.net","spamfree24.org","spamgourmet.com","spamherelots.com","spamhole.com","spamify.com","spaminator.de","spamkill.info","spaml.com","spaml.de","spammotel.com","spamobox.com","spamspot.com","spamthis.co.uk","spamthisplease.com","supergreatmail.com","supermailer.jp","suremail.info","teewars.org","teleworm.com","tempalias.com","tempe-mail.com","tempemail.biz","tempemail.com","tempemail.net","tempinbox.co.uk","tempinbox.com","tempmail.it","tempmail2.com","tempomail.fr","temporarioemail.com.br","temporaryemail.net","temporaryinbox.com","thanksnospam.info","thankyou2010.com","thisisnotmyrealemail.com","throwawayemailaddress.com","tmailinator.com","tradermail.info","trash-amil.com","trash-mail.com","trash-mail.de","trash2009.com","trashemail.de","trashmail.at","trashmail.com","trashmail.net","trashmail.ws","trashmailer.com","trashymail.com","trashymail.net","trillianpro.com","tyldd.com","uggsrock.com","veryrealemail.com","webm4il.info","wegwerfemail.de","wh4f.org","whyspam.me","willselfdestruct.com","wuzupmail.net","yopmail.com","yuurok.com","zehnminutenmail.de","zippymail.info","zoaxe.com","10minutemail.com","disposeamail.com","dontreg.com","e4ward.com","guerrillamail.com","inbox2.info","jetable.com","kasmail.com","killmail.net","maileater.com","mailexpire.com","mailinator.com","mailmoat.com","mytrashmail.com","netmails.net","noclickemail.com","nullbox.info","pookmail.com","shortmail.net","sneakemail.com","spambob.com","spambob.org","spambox.info","spambox.org","spambox.us","spamex.com","spamfree24.net","spamfree24.org","spamgourmet.com","spamhole.com","spammotel.com","tempinbox.com","temporaryforwarding.com","temporaryinbox.com","trashmail.net","xemaps.com","yopmail.com","getairmail.com","33mail.com")).'/';

function MailChecker($email){
if(preg_match($pattern, $email)){return false;}
return filter_var($email, FILTER_VALIDATE_EMAIL);
}
15 changes: 15 additions & 0 deletions platform/php/mailchecker.tmpl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
/**
* Usage
*
* include('mailchecker/platform/php/Mailchecker.php');
* MailChecker(String email);
* @return {Boolean} true is the specified email is valid, false otherwise
*/

$pattern = '/'.implode('|', array({{& listSTR }})).'/';

function MailChecker($email){
if(preg_match($pattern, $email)){return false;}
return filter_var($email, FILTER_VALIDATE_EMAIL);
}

0 comments on commit b6cc54c

Please sign in to comment.