220ZEND_BEGIN_ARG_INFO_EX(arginfo_check_tld, 0, 0, 1)
221 ZEND_ARG_INFO(0, uri)
226ZEND_BEGIN_ARG_INFO_EX(arginfo_check_uri, 0, 0, 1)
227 ZEND_ARG_INFO(0, uri)
232ZEND_BEGIN_ARG_INFO_EX(arginfo_check_email, 0, 0, 1)
233 ZEND_ARG_INFO(0, email)
239 PHP_FE(check_tld, arginfo_check_tld)
241 PHP_FE(check_email, arginfo_check_email)
249 STANDARD_MODULE_HEADER,
263 STANDARD_MODULE_PROPERTIES_EX
279 int argc = ZEND_NUM_ARGS();
288 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"s", &query, &query_len) == FAILURE)
293 r =
tld(query, &info);
295 array_init(return_value);
296 add_assoc_long(return_value,
"result", r);
297 add_assoc_long(return_value,
"category", info.
f_category);
298 add_assoc_long(return_value,
"status", info.
f_status);
299 add_assoc_long(return_value,
"offset", info.
f_offset);
302 add_assoc_string(return_value,
"country", (
char *) info.
f_country, 1);
304 if(info.
f_tld != NULL)
306 add_assoc_string(return_value,
"tld", (
char *) info.
f_tld, 1);
315 char *query, *protocols;
316 int query_len, *protocols_len;
317 int argc = ZEND_NUM_ARGS();
327 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"ssl", &query, &query_len, &protocols, &protocols_len, &flags) == FAILURE)
334 array_init(return_value);
335 add_assoc_long(return_value,
"result", r);
336 add_assoc_long(return_value,
"category", info.
f_category);
337 add_assoc_long(return_value,
"status", info.
f_status);
338 add_assoc_long(return_value,
"offset", info.
f_offset);
341 add_assoc_string(return_value,
"country", (
char *) info.
f_country, 1);
343 if(info.
f_tld != NULL)
345 add_assoc_string(return_value,
"tld", (
char *) info.
f_tld, 1);
357 int argc = ZEND_NUM_ARGS();
370 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"sl", &emails, &emails_len, &flags) == FAILURE)
381 array_init(return_value);
390 ALLOC_INIT_ZVAL(email_arr);
391 array_init(email_arr);
395 add_assoc_string(email_arr,
"group", (
char *) email.
f_group, 1);
397 add_assoc_string(email_arr,
"original_email", (
char *) email.
f_original_email, 1);
398 add_assoc_string(email_arr,
"fullname", (
char *) email.
f_fullname, 1);
399 add_assoc_string(email_arr,
"username", (
char *) email.
f_username, 1);
400 add_assoc_string(email_arr,
"domain", (
char *) email.
f_domain, 1);
401 add_assoc_string(email_arr,
"email_only", (
char *) email.
f_email_only, 1);
404 add_index_zval(return_value, idx, email_arr);
408 add_assoc_long(return_value,
"count", idx);
411 add_assoc_long(return_value,
"result", r);
PHP_FUNCTION(check_tld)
Declaration of the check_tld() function in PHP.
zend_module_entry * get_module(void)
Function called to retrieve the module information.
const zend_function_entry libtld_functions[]
The list of functions we offer to PHP.
zend_module_entry libtld_module_entry
The module definition.
The C++ side of the email list implementation.
const char * f_group
The group this emails was defined in.
const char * f_canonicalized_email
The email including the display name.
const char * f_original_email
The email as read from the source.
const char * f_email_only
The complete email address without display name.
const char * f_username
The user being named in this email address.
const char * f_domain
The domain part of the email address.
const char * f_fullname
The user full or display name.
Set of information returned by the tld() function.
enum tld_category f_category
The category of the TLD.
enum tld_status f_status
The status of the TLD.
int f_offset
The offset to the TLD in the URI string you supplied.
char f_country[48]
The country where this TLD is used.
const char * f_tld
Pointer to the TLD in the URI string you supplied.
The public header of the libtld library.
LIBTLD_EXPORT void tld_email_free(struct tld_email_list *list)
Free the list of emails.
LIBTLD_EXPORT enum tld_result tld(const char *uri, struct tld_info *info)
Get information about the TLD for the specified URI.
LIBTLD_EXPORT struct tld_email_list * tld_email_alloc()
Allocate a list of emails object.
LIBTLD_EXPORT enum tld_result tld_email_parse(struct tld_email_list *list, const char *emails, int flags)
Parse a list of emails in the email list object.
LIBTLD_EXPORT enum tld_result tld_check_uri(const char *uri, struct tld_info *info, const char *protocols, int flags)
Check that a URI is valid.
@ TLD_RESULT_SUCCESS
Success! The TLD of the specified URI is valid.
LIBTLD_EXPORT int tld_email_next(struct tld_email_list *list, struct tld_email *e)
Retrieve the next email.
void list()
List the default schemes accepted.
void check_uri(char const *uri)
Check the parameter as a URI.