From aa53d52798687aa884e5b95d36a013f33c694eaf Mon Sep 17 00:00:00 2001 From: Toon Schoenmakers Date: Fri, 13 Mar 2015 11:55:14 +0100 Subject: Implemented a simple sapi_name() method which will return the current sapi --- include/call.h | 1 + zend/includes.h | 1 + zend/sapi.cpp | 31 +++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 zend/sapi.cpp diff --git a/include/call.h b/include/call.h index 53030d2..e339ece 100644 --- a/include/call.h +++ b/include/call.h @@ -46,6 +46,7 @@ extern Value require(const char *filename); inline Value require(const std::string &filename) { return require(filename.c_str()); } extern Value require_once(const char *filename); inline Value require_once(const std::string &filename) { return require_once(filename.c_str()); } +extern const char *sapi_name(); /** * Call a function in PHP diff --git a/zend/includes.h b/zend/includes.h index aa33c71..c092a07 100644 --- a/zend/includes.h +++ b/zend/includes.h @@ -37,6 +37,7 @@ #include #include #include +#include /** * Macro to convert results to success status diff --git a/zend/sapi.cpp b/zend/sapi.cpp new file mode 100644 index 0000000..79393f7 --- /dev/null +++ b/zend/sapi.cpp @@ -0,0 +1,31 @@ +/** + * Sapi.cpp + * + * This file holds the implementation for the Php::sapi_name() function + * + * @author Toon Schoenmakers + */ + +/** + * Dependencies + */ +#include "includes.h" + +/** + * Open PHP namespace + */ +namespace Php { + +/** + * Retrieve the sapi name we're running on + * @return const char* + */ +const char *sapi_name() +{ + return sapi_module.name; +} + +/** + * End of namespace + */ +} -- cgit v1.2.3