blob: fce7c6dd85068985c83fb5fce42de38d7fb3fc0f (
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
|
<?php
namespace Safe;
use Safe\Exceptions\OutcontrolException;
/**
* This function discards the contents of the topmost output buffer and turns
* off this output buffering. If you want to further process the buffer's
* contents you have to call ob_get_contents before
* ob_end_clean as the buffer contents are discarded
* when ob_end_clean is called.
*
* The output buffer must be started by
* ob_start with PHP_OUTPUT_HANDLER_CLEANABLE
* and PHP_OUTPUT_HANDLER_REMOVABLE
* flags. Otherwise ob_end_clean will not work.
*
* @throws OutcontrolException
*
*/
function ob_end_clean(): void
{
error_clear_last();
$result = \ob_end_clean();
if ($result === false) {
throw OutcontrolException::createFromPhpError();
}
}
/**
* This function will send the contents of the topmost output buffer (if
* any) and turn this output buffer off. If you want to further
* process the buffer's contents you have to call
* ob_get_contents before
* ob_end_flush as the buffer contents are
* discarded after ob_end_flush is called.
*
* The output buffer must be started by
* ob_start with PHP_OUTPUT_HANDLER_FLUSHABLE
* and PHP_OUTPUT_HANDLER_REMOVABLE
* flags. Otherwise ob_end_flush will not work.
*
* @throws OutcontrolException
*
*/
function ob_end_flush(): void
{
error_clear_last();
$result = \ob_end_flush();
if ($result === false) {
throw OutcontrolException::createFromPhpError();
}
}
/**
* This function adds another name/value pair to the URL rewrite mechanism.
* The name and value will be added to URLs (as GET parameter) and forms
* (as hidden input fields) the same way as the session ID when transparent
* URL rewriting is enabled with session.use_trans_sid.
*
* This function's behaviour is controlled by the url_rewriter.tags and
* url_rewriter.hosts php.ini
* parameters.
*
* Note that this function can be successfully called at most once per request.
*
* @param string $name The variable name.
* @param string $value The variable value.
* @throws OutcontrolException
*
*/
function output_add_rewrite_var(string $name, string $value): void
{
error_clear_last();
$result = \output_add_rewrite_var($name, $value);
if ($result === false) {
throw OutcontrolException::createFromPhpError();
}
}
/**
* This function resets the URL rewriter and removes all rewrite
* variables previously set by the output_add_rewrite_var
* function.
*
* @throws OutcontrolException
*
*/
function output_reset_rewrite_vars(): void
{
error_clear_last();
$result = \output_reset_rewrite_vars();
if ($result === false) {
throw OutcontrolException::createFromPhpError();
}
}
|