Loads source HTML into memory, either from $source string or a file.

@param string $source    HTML content
@param bool   $from_file Indicates $source is a file to pull content from
485
public function set_html($source, $from_file = false)
    {
        if ($from_file && file_exists($source)) {
            $this->html = file_get_contents($source);
        } else {
            $this->html = $source;
        }

        $this->_converted = false;
    }
1087587
private function initSource($source)
    {
        if (empty($this->source)) {
            $this->source = new Source();
        }

        if (!empty($source)) {
            if (is_array($source)) {
                $this->source->setLines($source);
            } elseif (is_string($source)) {
                $this->source->setString($source);
            }
        }
    }
449649
public function parseSourceFile(string $fileContents, string $uri = null) : SourceFileNode {
        $this->lexer = TokenStreamProviderFactory::GetTokenStreamProvider($fileContents);

        $this->reset();

        $sourceFile = new SourceFileNode();
        $this->sourceFile = $sourceFile;
        $sourceFile->fileContents = $fileContents;
        $sourceFile->uri = $uri;
        $sourceFile->statementList = array();
        if ($this->getCurrentToken()->kind !== TokenKind::EndOfFileToken) {
            $inlineHTML = $this->parseInlineHtml($sourceFile);
            $sourceFile->statementList[] = $inlineHTML;
            if ($inlineHTML->echoStatement) {
                $sourceFile->statementList[] = $inlineHTML->echoStatement;
                $inlineHTML->echoStatement->parent = $sourceFile;
                $inlineHTML->echoStatement = null;
            }
        }
        $sourceFile->statementList =
            \array_merge($sourceFile->statementList, $this->parseList($sourceFile, ParseContext::SourceElements));

        $this->sourceFile->endOfFileToken = $this->eat1(TokenKind::EndOfFileToken);
        $this->advanceToken();

        $sourceFile->parent = null;

        return $sourceFile;
    }
1245892
def load(source):
    
    parser = get_xml_parser()
    return etree.parse(source, parser=parser).getroot()
157915
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
    {
        $source->filepath = $this->buildFilepath($source, $_template);

        if ($source->filepath !== false) {
            if (is_object($source->smarty->security_policy)) {
                $source->smarty->security_policy->isTrustedResourceDir($source->filepath);
            }

            $source->uid = sha1($source->filepath);
            if ($source->smarty->compile_check) {
                $source->timestamp = @filemtime($source->filepath);
                $source->exists = !!$source->timestamp;
            }
        }
    }
517826
async function loadSources (sources, options) {
  const mergedConfig = {};

  function handleSourceLoad (sourceConfig) {
    if (sourceConfig) merge(sourceConfig, mergedConfig);
  }

  for (const source of sources) {
    let sourceConfig;

    if (source == null) {
            // No-op... skip this source
      continue;
    } else if (typeof source === 'string') {
            // Load a source from a JSON file
      sourceConfig = await loadFileSource(source, options);
    } else if (Array.isArray(source)) {
      sourceConfig = await loadSources(source, options); // Load and merge all of the sources
    } else if (typeof source === 'function') {
      sourceConfig = await source(); // Invoke the function to asynchronously load the config object for this source
    } else if (typeof source === 'object') {
      sourceConfig = source; // Just merge the object
    } else {
      throw new Error('Invalid configuration source: ' + source);
    }

    handleSourceLoad(sourceConfig);
  }

  return mergedConfig;
}
42068
private function GenerateOutput($source) {
        array_push($this->Attributes, HtmlAttribute::Instanciate(HtmlAttributeConstants::Src, $source));
        $this->HtmlOutput = '<script type="application/javascript" {0}></script>';
        HtmlControlBuildHelper::Init()->GenerateAttributes($this);
    }
850505
function load (source, options, callback = noop) {
      if (typeof options === 'function') callback = options, options = {}
      options = assign({type: null, encoding: 'base64'}, options)

      // Callback handler
      var contents = window.webContents
      eventcb(contents, 'did-finish-load', 'did-fail-load', callback)

      // Load source as data:
      if (options.type) {
        const data = Buffer.from(source).toString(options.encoding)
        return window.loadURL(`data:${options.type};${options.encoding},${data}`, options)
      }

      // Load source as URL:
      const protocol = url.parse(source).protocol
      if (!protocol) source = 'file://' + source
      return window.loadURL(source, options)
    }
370533
public static function readStream($source)
    {
        if (!$source) {
            return false;
        }
        try {
            $file = @fopen($source, 'rb');
            $content = '';
            do {
                $data = fread($file, 8192);
                if (strlen($data) == 0) {
                    break;
                }
                $content .= $data;
            } while (true);
            @fclose($file);
            return $content;
        } catch (\Exception $e) {
            return false;
        }
    }
894850
function load(string $file = null)
    {
        if ($file == null) {
            $file = static::$configFile;
        }
        if (!file_exists($file)) {
            return false;
        }

        $a = json_decode(file_get_contents($file));

        if (isset($a->css)) {
            $this->css = $a->css;
        }

        if (isset($a->js)) {
            $this->js = $a->js;
        }
        
        if (isset($a->jss)) {
            $this->jss = $a->jss;
        }
        
        return true;
    }
845239
public function loadString($source, $url = null)
    {
        $name = crc32($url ?: $source);

        if(!$file = $this->isCached($name))
        {
            //Compile the template
            $source = $this->_compile($source);

            if($source === false) {
                throw new RuntimeException(sprintf('The template content cannot be compiled.'));
            }

            $file = $this->cache($name, $source);
        }

        $this->_source = $file;

        //Push the template on the stack
        array_push($this->_stack, $url);

        //Store the location
        if($url) {
            $this->_locations[$url] = $file;
        }

        return $this;
    }
135479
public function load($source)
    {
        if ($this->isFile($source)) {
            return $this->loadFile($source);
        } else {
            return $this->loadString($source);
        }
    }
575521
public function loadXML($source, $options = null)
    {
        return $source ? parent::loadXML($this->iso2utf($source), $options) : false;
    }
512268
def extract_source_from_file(file_path, env = {})
      source = HtmlMockup::Template.open(file_path, :partials_path => self.project.partial_path, :layouts_path => self.project.layouts_path).render(env.dup)

      if @options[:url_relativize]
        source = relativize_urls(source, file_path)
      end
      
      source
    end
271679
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
    {
        $uid = '';
        $sources = array();
        $components = explode('|', $source->name);
        $exists = true;
        foreach ($components as $component) {
            /* @var \Smarty_Template_Source $_s */
            $_s = Smarty_Template_Source::load(null, $source->smarty, $component);
            if ($_s->type == 'php') {
                throw new SmartyException("Resource type {$_s->type} cannot be used with the extends resource type");
            }
            $sources[ $_s->uid ] = $_s;
            $uid .= $_s->filepath;
            if ($_template) {
                $exists = $exists && $_s->exists;
            }
        }
        $source->components = $sources;
        $source->filepath = $_s->filepath;
        $source->uid = sha1($uid);
        $source->exists = $exists;
        if ($_template) {
            $source->timestamp = $_s->timestamp;
        }
    }
444390
def set_load_from(self, load_from):
        """"""
        assert load_from is None or isinstance(load_from, Cache), \
            "load_from needs to be None or a Cache object."
        assert load_from is None or load_from.cl_size <= self.cl_size, \
            "cl_size may only increase towards main memory."
        self.load_from = load_from
        self.backend.load_from = load_from.backend
1078269
def _load_from(self, line):
        '''
        '''
        # Remove any comments
        line = line.split('#',1)[0]        
        line = re.sub('(F|f)(R|r)(O|o)(M|m):','', line).strip()
        bot.info('FROM %s' %line)
        self.config['from'] = line