summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToon Schoenmakers <toon.schoenmakers@copernica.com>2015-03-13 11:55:14 +0100
committerToon Schoenmakers <toon.schoenmakers@copernica.com>2015-03-13 11:55:14 +0100
commitaa53d52798687aa884e5b95d36a013f33c694eaf (patch)
tree2dd4bda01ae549131fccfae2f230a5a2daf1b78a
parent1c979ff4204876698426b95f11636a7668a8932b (diff)
Implemented a simple sapi_name() method which will return the current sapi
-rw-r--r--include/call.h1
-rw-r--r--zend/includes.h1
-rw-r--r--zend/sapi.cpp31
3 files changed, 33 insertions, 0 deletions
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 <zend_exceptions.h>
#include <zend_interfaces.h>
#include <zend_ini.h>
+#include <SAPI.h>
/**
* 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 <toon.schoenmakers@copernica.com>
+ */
+
+/**
+ * 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
+ */
+}