PageRenderTime 50ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/runtime/ext/std/ext_std_output.php

https://gitlab.com/iranjith4/hhvm
PHP | 302 lines | 66 code | 29 blank | 207 comment | 0 complexity | 676910031aebd59950ab1b69104200f5 MD5 | raw file
  1. <?hh
  2. // generated by idl-to-hni.php
  3. /* This function will turn output buffering on. While output buffering is
  4. * active no output is sent from the script (other than headers), instead the
  5. * output is stored in an internal buffer. The contents of this internal
  6. * buffer may be copied into a string variable using ob_get_contents(). To
  7. * output what is stored in the internal buffer, use ob_end_flush().
  8. * Alternatively, ob_end_clean() will silently discard the buffer contents.
  9. * Warning Some web servers (e.g. Apache) change the working directory of a
  10. * script when calling the callback function. You can change it back by e.g.
  11. * chdir(dirname($_SERVER['SCRIPT_FILENAME'])) in the callback function.
  12. * Output buffers are stackable, that is, you may call ob_start() while
  13. * another ob_start() is active. Just make sure that you call ob_end_flush()
  14. * the appropriate number of times. If multiple output callback functions are
  15. * active, output is being filtered sequentially through each of them in
  16. * nesting order.
  17. * @param mixed $output_callback - An optional output_callback function may be
  18. * specified. This function takes a string as a parameter and should return a
  19. * string. The function will be called when the output buffer is flushed
  20. * (sent) or cleaned (with ob_flush(), ob_clean() or similar function) or when
  21. * the output buffer is flushed to the browser at the end of the request. When
  22. * output_callback is called, it will receive the contents of the output
  23. * buffer as its parameter and is expected to return a new output buffer as a
  24. * result, which will be sent to the browser. If the output_callback is not a
  25. * callable function, this function will return FALSE. If the callback
  26. * function has two parameters, the second parameter is filled with a
  27. * bit-field consisting of PHP_OUTPUT_HANDLER_START, PHP_OUTPUT_HANDLER_CONT
  28. * and PHP_OUTPUT_HANDLER_END. If output_callback returns FALSE original
  29. * input is sent to the browser. The output_callback parameter may be
  30. * bypassed by passing a NULL value. ob_end_clean(), ob_end_flush(),
  31. * ob_clean(), ob_flush() and ob_start() may not be called from a callback
  32. * function. If you call them from callback function, the behavior is
  33. * undefined. If you would like to delete the contents of a buffer, return ""
  34. * (a null string) from callback function. You can't even call functions using
  35. * the output buffering functions like print_r($expression, true) or
  36. * highlight_file($filename, true) from a callback function. In PHP 4.0.4,
  37. * ob_gzhandler() was introduced to facilitate sending gz-encoded data to web
  38. * browsers that support compressed web pages. ob_gzhandler() determines what
  39. * type of content encoding the browser will accept and will return its output
  40. * accordingly.
  41. * @param int $chunk_size - If the optional parameter chunk_size is passed,
  42. * the buffer will be flushed after any output call which causes the buffer's
  43. * length to equal or exceed chunk_size. Default value 0 means that the
  44. * function is called only in the end, other special value 1 sets chunk_size
  45. * to 4096.
  46. * @param bool $erase - If the optional parameter erase is set to FALSE, the
  47. * buffer will not be deleted until the script finishes. This causes that
  48. * flushing and cleaning functions would issue a notice and return FALSE if
  49. * called.
  50. * @return bool - Returns TRUE on success or FALSE on failure.
  51. */
  52. <<__Native>>
  53. function ob_start(mixed $output_callback = null,
  54. int $chunk_size = 0,
  55. int $flags = PHP_OUTPUT_HANDLER_STDFLAGS): bool;
  56. /* This function discards the contents of the output buffer. This function
  57. * does not destroy the output buffer like ob_end_clean() does.
  58. */
  59. <<__Native>>
  60. function ob_clean(): void;
  61. /* This function will send the contents of the output buffer (if any). If you
  62. * want to further process the buffer's contents you have to call
  63. * ob_get_contents() before ob_flush() as the buffer contents are discarded
  64. * after ob_flush() is called. This function does not destroy the output
  65. * buffer like ob_end_flush() does.
  66. */
  67. <<__Native>>
  68. function ob_flush(): bool;
  69. /* This function discards the contents of the topmost output buffer and turns
  70. * off this output buffering. If you want to further process the buffer's
  71. * contents you have to call ob_get_contents() before ob_end_clean() as the
  72. * buffer contents are discarded when ob_end_clean() is called.
  73. * @return bool - Returns TRUE on success or FALSE on failure. Reasons for
  74. * failure are first that you called the function without an active buffer or
  75. * that for some reason a buffer could not be deleted (possible for special
  76. * buffer).
  77. */
  78. <<__Native>>
  79. function ob_end_clean(): bool;
  80. /* This function will send the contents of the topmost output buffer (if any)
  81. * and turn this output buffer off. If you want to further process the
  82. * buffer's contents you have to call ob_get_contents() before ob_end_flush()
  83. * as the buffer contents are discarded after ob_end_flush() is called. This
  84. * function is similar to ob_get_flush(), except that ob_get_flush() returns
  85. * the buffer as a string.
  86. * @return bool - Returns TRUE on success or FALSE on failure. Reasons for
  87. * failure are first that you called the function without an active buffer or
  88. * that for some reason a buffer could not be deleted (possible for special
  89. * buffer).
  90. */
  91. <<__Native>>
  92. function ob_end_flush(): bool;
  93. /* Flushes the write buffers of PHP and whatever backend PHP is using (CGI, a
  94. * web server, etc). This attempts to push current output all the way to the
  95. * browser with a few caveats. flush() may not be able to override the
  96. * buffering scheme of your web server and it has no effect on any client-side
  97. * buffering in the browser. It also doesn't affect PHP's userspace output
  98. * buffering mechanism. This means you will have to call both ob_flush() and
  99. * flush() to flush the ob output buffers if you are using those. Several
  100. * servers, especially on Win32, will still buffer the output from your script
  101. * until it terminates before transmitting the results to the browser. Server
  102. * modules for Apache like mod_gzip may do buffering of their own that will
  103. * cause flush() to not result in data being sent immediately to the client.
  104. * Even the browser may buffer its input before displaying it. Netscape, for
  105. * example, buffers text until it receives an end-of-line or the beginning of
  106. * a tag, and it won't render tables until the </table> tag of the outermost
  107. * table is seen. Some versions of Microsoft Internet Explorer will only
  108. * start to display the page after they have received 256 bytes of output, so
  109. * you may need to send extra whitespace before flushing to get those browsers
  110. * to display the page.
  111. */
  112. <<__Native>>
  113. function flush(): void;
  114. /* Gets the current buffer contents and delete current output buffer.
  115. * ob_get_clean() essentially executes both ob_get_contents() and
  116. * ob_end_clean().
  117. * @return mixed - Returns the contents of the output buffer and end output
  118. * buffering. If output buffering isn't active then FALSE is returned.
  119. */
  120. <<__Native>>
  121. function ob_get_clean(): mixed;
  122. /* Gets the contents of the output buffer without clearing it.
  123. * @return mixed - This will return the contents of the output buffer or
  124. * FALSE, if output buffering isn't active.
  125. */
  126. <<__Native>>
  127. function ob_get_contents(): mixed;
  128. /* ob_get_flush() flushes the output buffer, return it as a string and turns
  129. * off output buffering. This function is similar to ob_end_flush(), except
  130. * that this function returns the buffer as a string.
  131. * @return mixed - Returns the output buffer or FALSE if no buffering is
  132. * active.
  133. */
  134. <<__Native>>
  135. function ob_get_flush(): mixed;
  136. /* This will return the length of the contents in the output buffer.
  137. * @return int - Returns the length of the output buffer contents or FALSE if
  138. * no buffering is active.
  139. */
  140. <<__Native>>
  141. function ob_get_length(): int;
  142. /* Returns the nesting level of the output buffering mechanism.
  143. * @return int - Returns the level of nested output buffering handlers or zero
  144. * if output buffering is not active.
  145. */
  146. <<__Native>>
  147. function ob_get_level(): int;
  148. /* ob_get_status() returns status information on either the top level output
  149. * buffer or all active output buffer levels if full_status is set to TRUE.
  150. * @param bool $full_status - TRUE to return all active output buffer levels.
  151. * If FALSE or not set, only the top level output buffer is returned.
  152. * @return array
  153. */
  154. <<__Native>>
  155. function ob_get_status(bool $full_status = false): array;
  156. /* ob_implicit_flush() will turn implicit flushing on or off. Implicit
  157. * flushing will result in a flush operation after every output call, so that
  158. * explicit calls to flush() will no longer be needed.
  159. * @param bool $flag - TRUE to turn implicit flushing on, FALSE otherwise.
  160. */
  161. <<__Native>>
  162. function ob_implicit_flush(bool $flag = true): void;
  163. /* Lists all output handlers in use.
  164. * @return array - This will return an array with the output handlers in use
  165. * (if any). If output_buffering is enabled or an anonymous function was used
  166. * with ob_start(), ob_list_handlers() will return "default output handler".
  167. */
  168. <<__Native>>
  169. function ob_list_handlers(): array;
  170. /* This function adds another name/value pair to the URL rewrite mechanism.
  171. * The name and value will be added to URLs (as GET parameter) and forms (as
  172. * hidden input fields) the same way as the session ID when transparent URL
  173. * rewriting is enabled with session.use_trans_sid. Please note that absolute
  174. * URLs (http://example.com/..) aren't rewritten. This function's behavior is
  175. * controlled by the url_rewriter.tags php.ini parameter. Calling this
  176. * function will implicitly start output buffering if it is not active
  177. * already.
  178. * @param string $name - The variable name.
  179. * @param string $value - The variable value.
  180. * @return bool - Returns TRUE on success or FALSE on failure.
  181. */
  182. <<__Native>>
  183. function output_add_rewrite_var(string $name,
  184. string $value): bool;
  185. /* This function resets the URL rewriter and removes all rewrite variables
  186. * previously set by the output_add_rewrite_var() function or the session
  187. * mechanism (if session.use_trans_sid was set on session_start()).
  188. * @return bool - Returns TRUE on success or FALSE on failure.
  189. */
  190. <<__Native>>
  191. function output_reset_rewrite_vars(): bool;
  192. /* Adds an entry to a log file that's written when server crashes. This is
  193. * useful for diagnose why server crashed. For example, logged-on user's ID.
  194. * @param string $name - Name of the value.
  195. * @param string $value - Value to write to log.
  196. */
  197. <<__HipHopSpecific, __Native>>
  198. function hphp_crash_log(string $name,
  199. string $value): void;
  200. /* Tallies a number for server stats.
  201. * @param string $name - Name of the entry. This name can then be used with
  202. * admin commands to retrieve stats while server is running.
  203. * @param int $value - An integer to add up.
  204. */
  205. <<__HipHopSpecific, __Native>>
  206. function hphp_stats(string $name,
  207. int $value): void;
  208. /* Checks current value of a server stats.
  209. * @param string $name - Name of the entry.
  210. * @return int - Currently accumulated count.
  211. */
  212. <<__HipHopSpecific, __Native>>
  213. function hphp_get_stats(string $name): int;
  214. /* Returns status of different server threads.
  215. * @return array - Array of thread statuses.
  216. */
  217. <<__HipHopSpecific, __Native>>
  218. function hphp_get_status(): array;
  219. /* Returns I/O status of current thread. EnableNetworkIOStatus has to be
  220. * turned on.
  221. * @return array - Array of all I/O so far for current thread.
  222. */
  223. <<__HipHopSpecific, __Native>>
  224. function hphp_get_iostatus(): array;
  225. /* Use this name, instead of IP address or URL for I/O status reporting. The
  226. * name will only be effective for the upcoming I/O and it will be reset
  227. * immediately after. Use logical network address for grouping network I/O by
  228. * intention, instead of physical addresses.
  229. * @param string $name - Specifies the logical name to replace with.
  230. */
  231. <<__HipHopSpecific, __Native>>
  232. function hphp_set_iostatus_address(string $name): void;
  233. /* Returns timestamps of different request events.
  234. * @param bool $get_as_float - same as in microtime() to specify output
  235. * format, except it defaults to true for float format.
  236. * @return mixed - An array of three timestamps: 'queue', the time a request
  237. * is received and queued up; 'process-wall', the wall clock time a request
  238. * starts to get processed; and 'process-cpu', the CPU clock time a request
  239. * starts to get processed.
  240. */
  241. <<__HipHopSpecific, __Native>>
  242. function hphp_get_timers(bool $get_as_float = true): mixed;
  243. /* Dumps all variables in global state, including global variables, static
  244. * variables, class statics and others.
  245. * @param bool $serialize - Specifies what format to use, whether to serialize
  246. * into a string.
  247. * @return mixed - An array of global state.
  248. */
  249. <<__HipHopSpecific, __Native>>
  250. function hphp_output_global_state(bool $serialize = true): mixed;
  251. /* @return int - Returns the current instruction counter value.
  252. */
  253. <<__HipHopSpecific, __Native("NoInjection")>>
  254. function hphp_instruction_counter(): int;
  255. /* @return mixed - An array of hardware counters
  256. */
  257. <<__HipHopSpecific, __Native("NoInjection")>>
  258. function hphp_get_hardware_counters(): mixed;
  259. /* @param string $events - comma separated list of hardware events
  260. * @return bool - returns TRUE on success and FALSE on failure
  261. */
  262. <<__HipHopSpecific, __Native("NoInjection")>>
  263. function hphp_set_hardware_events(?string $events = null): bool;
  264. <<__HipHopSpecific, __Native("NoInjection")>>
  265. function hphp_clear_hardware_events(): void;
  266. namespace __SystemLib {
  267. /* Print a hashbang if not run from the first source file executed. Otherwise
  268. * do nothing.
  269. * @param string $hashBang - the hashbang to print
  270. */
  271. <<__HipHopSpecific, __Native("NoInjection")>>
  272. function print_hashbang(string $hashBang): void;
  273. }