From 824a2d9f587ca017fc71b84d835e72f54f9c87c4 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Wed, 7 Nov 2018 18:02:36 +0100 Subject: Began rewrite --- node_modules/locutus/php/info/ini_set.js | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 node_modules/locutus/php/info/ini_set.js (limited to 'node_modules/locutus/php/info/ini_set.js') diff --git a/node_modules/locutus/php/info/ini_set.js b/node_modules/locutus/php/info/ini_set.js new file mode 100644 index 0000000..efd0ddc --- /dev/null +++ b/node_modules/locutus/php/info/ini_set.js @@ -0,0 +1,50 @@ +'use strict'; + +module.exports = function ini_set(varname, newvalue) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/ini_set/ + // original by: Brett Zamir (http://brett-zamir.me) + // note 1: This will not set a global_value or access level for the ini item + // example 1: ini_set('date.timezone', 'Asia/Hong_Kong') + // example 1: ini_set('date.timezone', 'America/Chicago') + // returns 1: 'Asia/Hong_Kong' + + var $global = typeof window !== 'undefined' ? window : global; + $global.$locutus = $global.$locutus || {}; + var $locutus = $global.$locutus; + $locutus.php = $locutus.php || {}; + $locutus.php.ini = $locutus.php.ini || {}; + + $locutus.php.ini = $locutus.php.ini || {}; + $locutus.php.ini[varname] = $locutus.php.ini[varname] || {}; + + var oldval = $locutus.php.ini[varname].local_value; + + var lowerStr = (newvalue + '').toLowerCase().trim(); + if (newvalue === true || lowerStr === 'on' || lowerStr === '1') { + newvalue = 'on'; + } + if (newvalue === false || lowerStr === 'off' || lowerStr === '0') { + newvalue = 'off'; + } + + var _setArr = function _setArr(oldval) { + // Although these are set individually, they are all accumulated + if (typeof oldval === 'undefined') { + $locutus.ini[varname].local_value = []; + } + $locutus.ini[varname].local_value.push(newvalue); + }; + + switch (varname) { + case 'extension': + _setArr(oldval, newvalue); + break; + default: + $locutus.php.ini[varname].local_value = newvalue; + break; + } + + return oldval; +}; +//# sourceMappingURL=ini_set.js.map \ No newline at end of file -- cgit v1.2.3