Attempts to load the dom from any resource, string, file, or URL.

@param string $str
@param array $options
@return $this
551703
public function load($str, $options = [])
    {
        // check if it's a file
        if (strpos($str, "\n") === false && is_file($str)) {
            return $this->loadFromFile($str, $options);
        }
        // check if it's a url
        if (preg_match("/^https?:\/\//i", $str)) {
            return $this->loadFromUrl($str, $options);
        }

        return $this->loadStr($str, $options);
    }
168173
public function load($str, Collection $collection)
	{
		$this->str = $str;
		$this->collection = $collection;

		return $this;
	}
888279
protected function parseTemplate($str)
    {
        $tag = '/{([\/$]?[-_:\w]*)}/';

        $input = preg_split($tag, $str, -1, PREG_SPLIT_DELIM_CAPTURE);

        $prefix = current($input);
        next($input);
        $this->template = [$prefix];

        $this->parseTemplateRecursive($input, $this->template);
    }
753765
public function slugify($str = '', $options = NULL)
    {
        try {
            if (!empty($options) && is_array($options)) {
                $slugify = new Slugify($options);
            } else {
                $slugify = new Slugify();
            }

            return $slugify->slugify($str);
        }
        catch (\Exception $e) {
            if (function_exists('log_message')) {
                $message = 'Error Code: ' . $e->getCode() . ' - File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Message: ' . $e->getMessage();
                log_message('error', $message);
            }

            return $this->common->convertStrToEn($str);
        }
    }
1198351
public function setHelpOptionShort($str) {
        if (!Option::validateShort($str)) {
            throw new ConfigException('short help option must be a single character');
        }
        $this->helpShort = $str;
        return $this;
    }
701608
public function set($str)
	{
		if ($str instanceof Path) {
			$this->path->set($str->get());
		} else if ($str instanceof UrlPath) {
			$this->path->set($str->get());
		} else if (is_string($str)) {
			$this->path->set($str);
		} else {
			throw new \InvalidArgumentException('Unexpected type.');
		}
	}
477691
function parse (str, options) {
  if (typeof str !== 'string') throw new TypeError('str is required!');

  var splitData = split(str);
  var raw = splitData.data;

  if (!raw) return { _content: str };

  var data;

  data = parseYAML(raw, options);

  if (!data) return { _content: str };

  data._content = splitData.content;

  return data;
}
674425
public function loadHtml($html, $options = null)
    {
        return $this->load($html, false, Document::TYPE_HTML, $options);
    }
907952
function load($str, $lowercase=true) {
        // prepare
        $this->prepare($str, $lowercase);
        // strip out comments
        $this->remove_noise("'<!--(.*?)-->'is");
        // strip out cdata
        $this->remove_noise("'<!\[CDATA\[(.*?)\]\]>'is", true);
        // strip out <style> tags
        $this->remove_noise("'<\s*style[^>]*[^/]>(.*?)<\s*/\s*style\s*>'is");
        $this->remove_noise("'<\s*style\s*>(.*?)<\s*/\s*style\s*>'is");
        // strip out <script> tags
        $this->remove_noise("'<\s*script[^>]*[^/]>(.*?)<\s*/\s*script\s*>'is");
        $this->remove_noise("'<\s*script\s*>(.*?)<\s*/\s*script\s*>'is");
        // strip out preformatted tags
        $this->remove_noise("'<\s*(?:code)[^>]*>(.*?)<\s*/\s*(?:code)\s*>'is");
        // strip out server side scripts
        $this->remove_noise("'(<\?)(.*?)(\?>)'s", true);
        // strip smarty scripts
        $this->remove_noise("'(\{\w)(.*?)(\})'s", true);

        // parsing
        while ($this->parse());
        // end
        $this->root->_[HDOM_INFO_END] = $this->cursor;
    }
264886
public function get($url, $data = array(), $options = array())
    {
        $query = http_build_query($data);
        if (!empty($query)) {
            $url = (strpos($url, '?')) ? $url . '&' . $query : $url . '?' . $query;
        }

        $this->request($url, false, $options);

        return $this;
    }
816091
public function setMetaCreator(string $str): PdfInterface
    {
        $this->setProperty('metaCreator', $str);
        $this->mpdf->SetCreator($this->metaCreator);

        return $this;
    }
554777
public function loadHTML( $html, $options = [] ) {
		$html = '<div><!-- pb_fixme -->' . $html . '<!-- pb_fixme --></div>';
		if ( $this->parser instanceof \DOMDocument ) {
			libxml_use_internal_errors( true );
			$this->parser->loadHTML( mb_convert_encoding( $html, 'HTML-ENTITIES', 'UTF-8' ), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD );
			$this->errors = libxml_get_errors();
			libxml_clear_errors();
			return $this->parser;
		} else {
			return $this->parser->loadHTML( $html, $options );
		}
	}
1174551
public function loadTemplateFromString($str)
    {
        $this->source = 'string: '.$str;
        $this->template = $this->tags = [];
        if (!$str) {
            return;
        }
        $this->tag_cnt = [];

        /* First expand self-closing tags {$tag} -> {tag}{/tag} */
        $str = preg_replace('/{\$([-_:\w]+)}/', '{\1}{/\1}', $str);

        $this->parseTemplate($str);

        return $this;
    }
392941
public static function fromString($str)
    {
        $set = new Stringset();
        $data = str_split($str, 1);
        $pos = 0;

        list(,$magic) = unpack('L', self::mergechars($data, $pos, 4));

        if ($magic !== self::MAGIC_NUMBER) {
            throw new Exception("This is not a MO string.");
        }

        list(,$version) = unpack('L', self::mergechars($data, $pos, 4));

        if ($version !== self::REVISION) {
            throw new Exception("This file format revision is not supported.");
        }

        list(,$nstrings) = unpack('L', self::mergechars($data, $pos, 4));
        list(,$ostart) = unpack('L', self::mergechars($data, $pos, 4));
        list(,$tstart) = unpack('L', self::mergechars($data, $pos, 4));

        for ($i = 0; $i < $nstrings; $i += 1) {
            $original = $ostart + ($i * 8);
            $translated = $tstart + ($i * 8);
            $original = unpack('Llength/Loffset', self::mergechars($data, $original, 8));
            $translated = unpack('Llength/Loffset', self::mergechars($data, $translated, 8));

            $id = self::mergechars($data, $original['offset'], $original['length'] + 1, false);
            $value = self::mergechars($data, $translated['offset'], $translated['length'] + 1, false);

            if ($id[strlen($id) - 1] !== self::NUL || $value[strlen($value) - 1] !== self::NUL) {
                throw new Exception("String wasn't NUL-terminated");
            }

            $result = array();

            $id = explode(self::NUL, $id);
            if (count($id) === 3) {
                $result['msgid_plural'] = $id[1];
            }
            $id = explode(self::EOT, $id[0]);
            if (count($id) === 2) {
                $result['msgctxt'] = $id[0];
                $result['msgid'] = $id[1];
            } else {
                $result['msgid'] = $id[0];
            }

            $value = explode(self::NUL, $value);
            array_pop($value);
            $result['msgstr'] = $value;
            $set->add($result);
        }
        return $set;
    }
292546
public static function url($name, $value = null, array $options = [])
    {
        self::exclure($options);

        return self::input('url', $name, $value, $options);
    }
424779
public function loadXml($xml, $options = null)
    {
        return $this->load($xml, false, Document::TYPE_XML, $options);
    }
1118045
public static function parse($str, $opts = array())
	{
		$params = array();
		$opts = \array_merge(
			array(
				'conv_dot'		=> false,
				'conv_space'	=> true,
			),
			$opts
		);
		if (( $opts['conv_dot'] || \strpos($str, '.') === false )
			&& ( $opts['conv_space'] || \strpos($str, ' ') === false )
		) {
			// just use parse_str
			\parse_str($str, $params);
		} else {
			$pairs = \explode('&', $str);
			foreach ($pairs as $pair) {
				$ptr = &$params;
				$pair = \array_map('urldecode', \explode('=', $pair));
				$path = $pair[0];
				$v = isset($pair[1])
					? $pair[1]
					: '';
				$i = 0;
				$re = '/^([^\[]*)/';
				while (\preg_match($re, $path, $matches)) {
					$k = $matches[1];
					$a = \preg_match('/^\s?$/', $k);		// 0 or 1 whitepace = append
					if ($i == 0) {
						// ltrim spaces as parse_str() does
						$k = \ltrim($k, ' ');
						if (\strlen($k) == 0) {
							break;
						}
						if ($opts['conv_space']) {
							$k = \str_replace(' ', '_', $k);
						}
						$re = '/^\[([^\]]*?)\](\s*)/';	// change regex
					} elseif (!empty($matches[2])) {
						$path = '';	// space on the end... this is the end of the path
					}
					$path = \substr($path, \strlen($matches[0]));	// remaining path
					if ($path !== false) {
						if ($a) {
							$ptr[] = array();
							\end($ptr);
							$k = \key($ptr);
						} elseif (!isset($ptr[ $k ]) || \is_string($ptr[ $k ])) {
							$ptr[ $k ] = array();
						}
						$ptr = &$ptr[$k];
					} else {
						if ($a) {
							$ptr[] = $v;
						} else {
							$ptr[ $k ] = $v;
						}
						break;
					}
					$i++;
				}
				if (!empty($path)) {
					// still have remaining path... there were unmatched brackets
					$ptr = $v;
				}
			}
		}
		return $params;
	}