phpjs
Version:
53 lines (44 loc) • 1.48 kB
Markdown
layout: page
title: "JavaScript ob_get_level function"
comments: true
sharing: true
footer: true
alias:
- /functions/view/ob_get_level:898
- /functions/view/ob_get_level
- /functions/view/898
- /functions/ob_get_level:898
- /functions/898
<!-- Generated by Rakefile:build -->
A JavaScript equivalent of PHP's ob_get_level
{% codeblock outcontrol/ob_get_level.js lang:js https://raw.github.com/kvz/phpjs/master/functions/outcontrol/ob_get_level.js raw on github %}
function ob_get_level () {
// http://kevin.vanzonneveld.net
// + original by: Brett Zamir (http://brett-zamir.me)
// * example 1: ob_get_level();
// * returns 1: 1
this.php_js = this.php_js || {};
var phpjs = this.php_js,
ini = phpjs.ini,
obs = phpjs.obs;
if (!obs || !obs.length) {
return (ini && ini['output_buffering'] && (typeof ini['output_buffering'].local_value !== 'string' || ini['output_buffering'].local_value.toLowerCase() !== 'off')) ? 1 : 0;
}
return obs.length;
}
{% endcodeblock %}
- [view on github](https://github.com/kvz/phpjs/blob/master/functions/outcontrol/ob_get_level.js)
- [edit on github](https://github.com/kvz/phpjs/edit/master/functions/outcontrol/ob_get_level.js)
### Example 1
This code
{% codeblock lang:js example %}
ob_get_level();
{% endcodeblock %}
Should return
{% codeblock lang:js returns %}
1
{% endcodeblock %}
### Other PHP functions in the outcontrol extension
{% render_partial _includes/custom/outcontrol.html %}