You are here

function simple_html_dom::load in simplehtmldom API 6

Same name and namespace in other branches
  1. 5.2 simplehtmldom/simple_html_dom.php \simple_html_dom::load()
  2. 7 simplehtmldom/simple_html_dom.php \simple_html_dom::load()
3 calls to simple_html_dom::load()
simple_html_dom::loadFile in simplehtmldom/simple_html_dom.php
simple_html_dom::load_file in simplehtmldom/simple_html_dom.php
simple_html_dom::__construct in simplehtmldom/simple_html_dom.php

File

simplehtmldom/simple_html_dom.php, line 526

Class

simple_html_dom

Code

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;
}