How to use the locutus.get_defined_constants.setConstants function in locutus

To help you get started, we’ve selected a few locutus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kvz / locutus / _experimental / php / info / get_defined_constants.js View on Github external
'IMAGETYPE_JP2': 10,
      'IMAGETYPE_JPX': 11,
      'IMAGETYPE_JB2': 12,
      'IMAGETYPE_SWC': 13,
      'IMAGETYPE_IFF': 14,
      'IMAGETYPE_WBMP': 15,
      'IMAGETYPE_JPEG2000': 9,
      'IMAGETYPE_XBM': 16
    }
  };

  if (this.php_js && this.php_js.ini && this.php_js.ini['locutus.get_defined_constants.setConstants'] && this.php_js.ini['locutus.get_defined_constants.setConstants'].local_value) {
    // Allow us to set a configuration to let this function set global constants
    if (this.php_js.ini['locutus.get_defined_constants.setConstants'].local_value === 'this') {
      win = this;
    } else if (this.php_js.ini['locutus.get_defined_constants.setConstants'].local_value === 'thisExt') {
      win = this;
      thisExt = true;
    } else {
      win = this.window;
    }

    for (ext in constObj) {
      if (thisExt) { // Allows namespacing constants (e.g,. this.pcre.PREG_OFFSET_CAPTURE)
        for (cnst in constObj[ext]) {
          if (!win[ext]) {
            win[ext] = {};
          }
          // These will not be real constants!
          win[ext][cnst] = constObj[ext][cnst];
        }
      } else {
github kvz / locutus / _experimental / php / info / get_defined_constants.js View on Github external
'IMAGETYPE_BMP': 6,
      'IMAGETYPE_TIFF_II': 7,
      'IMAGETYPE_TIFF_MM': 8,
      'IMAGETYPE_JPC': 9,
      'IMAGETYPE_JP2': 10,
      'IMAGETYPE_JPX': 11,
      'IMAGETYPE_JB2': 12,
      'IMAGETYPE_SWC': 13,
      'IMAGETYPE_IFF': 14,
      'IMAGETYPE_WBMP': 15,
      'IMAGETYPE_JPEG2000': 9,
      'IMAGETYPE_XBM': 16
    }
  };

  if (this.php_js && this.php_js.ini && this.php_js.ini['locutus.get_defined_constants.setConstants'] && this.php_js.ini['locutus.get_defined_constants.setConstants'].local_value) {
    // Allow us to set a configuration to let this function set global constants
    if (this.php_js.ini['locutus.get_defined_constants.setConstants'].local_value === 'this') {
      win = this;
    } else if (this.php_js.ini['locutus.get_defined_constants.setConstants'].local_value === 'thisExt') {
      win = this;
      thisExt = true;
    } else {
      win = this.window;
    }

    for (ext in constObj) {
      if (thisExt) { // Allows namespacing constants (e.g,. this.pcre.PREG_OFFSET_CAPTURE)
        for (cnst in constObj[ext]) {
          if (!win[ext]) {
            win[ext] = {};
          }