File loading ------------------------------------------------
960831
function(plugins) {
    _.each(
      plugins,
      _.bind(function(plugin) {
        if (!this.plugins[plugin]) {
          this.plugins[plugin] = this.requirePlugin(plugin);
        }
      }, this)
    );
  }
857156
function() {

      var filesArray = _files[_currentSegment].slice();

      $.each(filesArray, function(i, file) {

        log('preloading files');

        log('file to preload:' + file.source);
        switch (file.type) {
          case 'IMAGE':
            loadImage(file);
            break;
          case 'VIDEO':
          case 'AUDIO':
            loadMedia(file);
            break;
          case 'SCRIPT':
            loadScript(file);
            break;
          case 'TEXT':
          case 'CSS':
            loadText(file, /CSS/g.test(file.type));
            break;
          default:
            return false;
        }

      });

    }
704212
private void loadDataFromInternetAndSave() throws IOException {
		InputStream is = null;
		FileOutputStream fos = null;
		try {
			URL url = new URL(DATA_RETRIVE_URL);
			is = url.openStream();
			fos = new FileOutputStream(getCacheFile());
			byte[] buff = new byte[1024 * 8];
			int len = 0;
			while ((len = is.read(buff)) != -1) {
				fos.write(buff, 0, len);
			}
		} finally {
			if (is != null) {
				is.close();
			}
			if (fos != null) {
				fos.close();
			}
		}

	}
731254
public void load(File file) throws IOException {
        if (!file.exists()) {
            return; // NO-OP: Users may not have the saved file
        }
        if (!file.canRead()) {
            throw new IOException(String.format("Error while reading the file located at %s.\n" +
                    "Make sure you have the read permission at the location specified.", file.getAbsolutePath()));
        }
        
        // Clean the controller first before loading
        queryController.reset();
        
        LineNumberReader reader = new LineNumberReader(new FileReader(file));
        String line = "";
        while ((line = reader.readLine()) != null) {
        	try {
	            if (isCommentLine(line) || line.isEmpty()) {
	                continue; // skip comment lines and empty lines
	            }
	            if (line.contains(QUERY_GROUP)) {
	                // The group ID is enclosed by a double-quotes sign
	                String groupId = line.substring(line.indexOf("\"")+1, line.lastIndexOf("\""));
	                readQueryGroup(reader, groupId);
	            } else if (line.contains(QUERY_ITEM)) {
	                // The query ID is enclosed by a double-quotes sign
	                String queryId = line.substring(line.indexOf("\"")+1, line.lastIndexOf("\""));
	                readQueryContent(reader, "", queryId);
	            } else {
	            	throw new IOException("Unknown syntax: " + line);
	            }
        	} catch (Exception e) {
        		throw new IOException(String.format("Invalid syntax at line: %s", reader.getLineNumber()), e);
        	}
        }
    }
164868
function _loadFile(filename, callback) {
    callback = callback || function () { };

    if (filename.charAt(0) == '.') {
      callback();
      return;
    }

    var filepath = path.join(folder, filename);
    fs.readFile(filepath, function (err, data) {
      if (err) {
        console.error('Failed to read file ' + filepath + ' err:', err);
        callback(err);
        return;
      }
      try {
        _loadData(filename, data.toString());
      }
      catch (e) {
        console.info('Object ' + filename + ' was not yet fully written, exception:', e);
        // There will be another notification of change when the last write to file is completed.
        // Meanwhile leave the previous value.
        if (loader) {
          // Store this error to wait until file will be successfully loaded for the 1st time.
          loader.errors[filename] = e;
        }
        // Don't return error to continue asynchronous loading of other files. Errors are assembled on loader.
        callback();
        return;
      }
      console.log('Loaded ' + filename);
      if (loader) {
        if (loader.errors[filename]) {
          // File that previously failed to load, now is loaded.
          delete loader.errors[filename];
          var countErrors = Object.keys(loader.errors).length;
          if (countErrors === 0) {
            // All errors are fixed. This is the time to complete loading.
            var initcb = loader.callback;
            loader = null;
            _updateSingleton();
            initcb();
          }
        }
      }
      callback();
    });
  }
1258586
private function loadFile ($file)
	{
		if (!isset ($this->files[$file]))
		{
			$filename = $this->folder . $file . '.php';

			// First load these
			if (file_exists ($filename))
			{
				$this->files[$file] = include ($filename);
			}

			// Now overload with environment values
			if (isset ($this->environment))
			{
				$filename = $this->folder . $this->environment . '/' . $file . '.php';
				if (file_exists ($filename))
				{
					$this->merge ($file, include ($filename));
				}
			}

		}
	}
820055
function _onFinishedLoadingDOM() {
        var request = new XMLHttpRequest();
        request.open("GET", exports.url);
        request.onload = function onLoad() {
            if ((request.status >= 200 && request.status < 300) ||
                    request.status === 304 || request.status === 0) {
                _mapDocumentToSource(request.response);
                _load.resolve();
            } else {
                var msg = "Received status " + request.status + " from XMLHttpRequest while attempting to load source file at " + exports.url;
                _load.reject(msg, { message: msg });
            }
        };
        request.onerror = function onError() {
            var msg = "Could not load source file at " + exports.url;
            _load.reject(msg, { message: msg });
        };
        request.send(null);
    }
606676
public function load($value = null)
    {
        if (is_array($value)) {
            $this->loadFromArray($value);
        } elseif (is_string($value) && file_exists($value)){
            $this->loadFromFile($value);
        }
    }
273201
private function load()
	{
		if ($this->isLoaded())
		{
			return;
		}

		$path = sprintf('%s/../../lang/%s.php', __DIR__, $this->locale);

		if (file_exists($path))
		{
			$this->loaded[$this->locale] = require $path;
		}
	}
275731
function _load()
    {
        $file = $this->_getFilePath();
        if (! file_exists($file) )
            ## nothing to import, no data written yet!
            return;

        ErrorStack::handleError(E_ALL);
        ##  \\\\\
        $data = include $file;
        $data = $this->getDataInterchange()->retrieveBackward($data);
        ##  /////
        if ( $exception = ErrorStack::handleDone() )
            throw new exReadError('Error While Read Data.', $exception->getCode(), $exception);


        if (! is_array($data) )
            throw new exDataMalformed('Error Data Structure, it must be array.');

        $this->data = $data;
    }
722914
public function load_file()
	{
		$args = func_get_args();
		$this->load(call_user_func_array('file_get_contents', $args), true);
		// Throw an error if we can't properly load the dom.
		if (($error=error_get_last())!==null) {
			$this->clear();
			return false;
		}
	}
125072
private void loadFromFile() {
    // load from disk if the caller gave us a file
    if (file_location != null && !file_location.isEmpty()) {
      final File file = new File(file_location);
      if (!file.exists()) {
        LOG.warn("Query override file " + file_location + " does not exist");
        return;
      }
      try {
        final String raw_json = Files.toString(file, Const.UTF8_CHARSET);
        if (raw_json != null && !raw_json.isEmpty()) {
          final Set<QueryLimitOverrideItem> cached_items = 
              JSON.parseToObject(raw_json, TR_OVERRIDES);
          
          // iterate so we only change bits that are different.
          for (final QueryLimitOverrideItem override : cached_items) {
            QueryLimitOverrideItem existing = overrides.get(override.getRegex());
            if (existing == null || !existing.equals(override)) {
              overrides.put(override.getRegex(), override);
            }
          }
          
          // reverse quadratic, woot! Ugly but if the limit file is so big that
          // this takes over 60 seconds or starts blocking queries on modifications
          // to the map then something is really wrong.
          final Iterator<Entry<String, QueryLimitOverrideItem>> iterator = 
              overrides.entrySet().iterator();
          while (iterator.hasNext()) {
            final Entry<String, QueryLimitOverrideItem> entry = iterator.next();
            boolean matched = false;
            for (final QueryLimitOverrideItem override : cached_items) {
              if (override.getRegex().equals(entry.getKey())) {
                matched = true;
                break;
              }
            }
            if (!matched) {
              iterator.remove();
            }
          }
        }
        LOG.info("Successfully loaded query overrides: " + this);
      } catch (Exception e) {
        LOG.error("Failed to read cache file for query limit override: " + 
            this, e);
      }
    }
  }
227711
public function load()
    {
        foreach ($this->config['autoload'] as $file) {
            if ( ! locate_template($this->getRelativePath($file), true, true)) {
                throw new FileNotFoundException("Autoloaded file [{$this->getPath($file)}] cannot be found. Please, check your autoloaded entries in `config/app.php` file.");
            }
        }
    }
671973
protected void loadWaterMarks() throws IOException {
        // Load source water marks from file
        if (file != null && file.exists()) {
            try {
                loadWaterMarks(file);
            } catch (IOException e) {
                if (fileOriginal != null && fileOriginal.exists()) {
                    loadWaterMarks(fileOriginal);
                }
            }
        }
    }
343288
@Override
    public void load()
    {
        if (surface == null)
        {
            surface = Graphics.createImageBuffer(map.getInTileWidth(), map.getInTileHeight(), ColorRgba.TRANSPARENT);
        }
    }
180348
function(file) {
      var defer = new $.Deferred(),
        size = file.size,
        $image = $('<img>'),
        onImageLoaded = function() {

          log('File Loaded:' + src);
          _bytesLoaded += size;
          onElementLoaded(file, this);
          // removing the file from the array
          _files[_currentSegment].splice(0, 1);
          updatePercentage();
          defer.resolve();

        },
        onImageError = function() {
          log('File load error : ' + src);
          _bytesLoaded += size;
          // removing the file from the array
          _files[_currentSegment].splice(0, 1);
          updatePercentage();
          defer.resolve();
        },
        src;

      // load the svg or the fallback image
      if (file.source.toString() === '[object Object]') {
        if (file.source.svg && _support.svg) {
          src = file.source.svg;
        } else if (file.source.fallback) {
          src = file.source.fallback;
        }
      } else {
        src = file.source;
      }

      $image.on('load', onImageLoaded);
      $image.on('error', onImageError);
      $image.attr('src', src);

      // preventing a memory leak
      $image = null;

      return defer.promise();
    }
1234862
protected function scanLoadConfig(): void
    {
        /* @var SplFileInfo $directory */
        /* @var SplFileInfo $file */
        foreach (Finder::create()->directories()->depth(1)->name('Config')->in($this->modulePath()) as $directory) {
            foreach (Finder::create()->files()->name('*.php')->in($directory->getPathname()) as $file) {
                $this->mergeConfigFrom($file->getPathname(), Str::snake($directory->getRelativePath()));
            }
        }
    }