blob: 4ad54a3e93b23981dc76a1ec27e48e77959a2673 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
/**
* Extension.cpp
*
* @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
* @copyright 2013, 2014 Copernica BV
*/
#include "includes.h"
/**
* Set up namespace
*/
namespace Php {
/**
* Constructor that defines a number of functions right away
* @param name Extension name
* @param version Extension version string
* @param apiversion API version number
*/
Extension::Extension(const char *name, const char *version, int apiversion) :
Namespace(""), _impl(new ExtensionImpl(this, name, version, apiversion)) {}
/**
* Destructor
*/
Extension::~Extension()
{
// get rid of the implementation object
delete _impl;
}
/**
* Register a function to be called when the PHP engine is ready
* @param callback
* @return Extension
*/
Extension &Extension::onStartup(const Callback &callback)
{
// pass on to the implementation
_impl->onStartup(callback);
// allow chaining
return *this;
}
/**
* Register a function to be called when the PHP engine is going to stop
* @param callback
* @return Extension
*/
Extension &Extension::onShutdown(const Callback &callback)
{
// pass on to the implementation
_impl->onShutdown(callback);
// allow chaining
return *this;
}
/**
* Register a callback that is called at the beginning of each pageview/request
* @param callback
*/
Extension &Extension::onRequest(const Callback &callback)
{
// pass on to the implementation
_impl->onRequest(callback);
// allow chaining
return *this;
}
/**
* Register a callback that is called to cleanup things after a pageview/request
* @param callback
*/
Extension &Extension::onIdle(const Callback &callback)
{
// pass on to the implementation
_impl->onIdle(callback);
// allow chaining
return *this;
}
/**
* Retrieve the module pointer
*
* This is the memory address that should be exported by the get_module()
* function.
*
* @return void*
*/
void *Extension::module()
{
// pass on to the implementation
return _impl->module();
}
/**
* Is the extension object in a locked state? This happens after the
* get_module() function was called for the first time ("apache reload"
* forces a new call to get_module())
*
* @return bool
*/
bool Extension::locked() const
{
return _impl->locked();
}
/**
* End of namespace
*/
}
|