-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1e681d2
Showing
4 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,8 @@ | |||
PHP Bindings for libphonenumber | |||
by Andrew Brampton 2011 | |||
|
|||
WORK IN PROGRESS - NO WHERE NEAR FINISHED.... | |||
|
|||
Notes: | |||
http://devzone.zend.com/303/extension-writing-part-i-introduction-to-php-and-zend/ | |||
http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,10 @@ | |||
PHP_ARG_ENABLE(phonenumber, | |||
[Whether to enable libphonenumber support], | |||
[ --enable-phonenumber Enable libphonenumber support]) | |||
|
|||
if test "$PHP_PHONENUMBER" = "yes"; then | |||
PHP_REQUIRE_CXX() | |||
PHP_SUBST(PHONENUMBER_SHARED_LIBADD) | |||
PHP_ADD_LIBRARY(stdc++, 1, PHONENUMBER_SHARED_LIBADD) | |||
PHP_NEW_EXTENSION(phonenumber, phonenumber.cc, $ext_shared) | |||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,57 @@ | |||
#include "php_phonenumber.h" | |||
|
|||
zend_class_entry *phonenumber_util_ce; | |||
|
|||
PHP_METHOD(PhoneNumberUtil, __construct) | |||
{ | |||
PhoneNumberUtil::GetInstance(); | |||
} | |||
|
|||
PHP_METHOD(PhoneNumberUtil, isAlphaNumber) | |||
{ | |||
Car *car; | |||
car_object *obj = (car_object *)zend_object_store_get_object(getThis() TSRMLS_CC); | |||
car = obj->car; | |||
if (car == NULL) { | |||
RETURN_NULL(); | |||
} | |||
RETURN_BOOLEAN(pn->IsAlphaNumber("hello")); | |||
} | |||
|
|||
function_entry phonenumber_util_methods[] = { | |||
PHP_ME(PhoneNumberUtil, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) | |||
PHP_ME(PhoneNumberUtil, isAlphaNumber, NULL, ZEND_ACC_PUBLIC) | |||
{NULL, NULL, NULL} | |||
}; | |||
|
|||
|
|||
PHP_MINIT_FUNCTION(phonenumber) | |||
{ | |||
zend_class_entry ce; | |||
INIT_CLASS_ENTRY(ce, "PhoneNumberUtil", phonenumber_util_methods); | |||
phonenumber_util_ce = zend_register_internal_class(&ce TSRMLS_CC); | |||
return SUCCESS; | |||
} | |||
|
|||
zend_module_entry vehicles_module_entry = { | |||
#if ZEND_MODULE_API_NO >= 20010901 | |||
STANDARD_MODULE_HEADER, | |||
#endif | |||
PHP_PHONENUMBER_EXTNAME, | |||
NULL, /* Functions */ | |||
PHP_MINIT(phonenumber), | |||
NULL, /* MSHUTDOWN */ | |||
NULL, /* RINIT */ | |||
NULL, /* RSHUTDOWN */ | |||
NULL, /* MINFO */ | |||
#if ZEND_MODULE_API_NO >= 20010901 | |||
PHP_PHONENUMBER_EXTVER, | |||
#endif | |||
STANDARD_MODULE_PROPERTIES | |||
}; | |||
|
|||
#ifdef COMPILE_DL_PHONENUMBER | |||
extern "C" { | |||
ZEND_GET_MODULE(phonenumber) | |||
} | |||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,20 @@ | |||
#ifndef PHP_HELLO_H | |||
#define PHP_HELLO_H 1 | |||
|
|||
#define PHP_PHONENUMBER_EXTNAME "phonenumber" | |||
#define PHP_PHONENUMBER_EXTVER "1.0" | |||
|
|||
#ifdef HAVE_CONFIG_H | |||
#include "config.h" | |||
#endif | |||
|
|||
extern "C" { | |||
#include "php.h" | |||
} | |||
|
|||
extern zend_module_entry phonenumber_module_entry; | |||
#define phpext_phonenumber_ptr &phonenumber_module_entry; | |||
|
|||
#endif | |||
|
|||
|