You are here

protected function FeedsCrawler::errorStop in Feeds Crawler 7

Stops custom error handling.

Parameters

bool $use: The previous value of use_errors.

bool $print: (Optional) Whether to print errors to the screen. Defaults to TRUE.

2 calls to FeedsCrawler::errorStop()
FeedsCrawler::parseAuto in ./FeedsCrawler.inc
Paginates using Atom's rel=next link automatically.
FeedsCrawler::parseXPath in ./FeedsCrawler.inc
Finds the "next" link on a page via XPath.

File

./FeedsCrawler.inc, line 353
Home of the FeedsCrawler.

Class

FeedsCrawler
Fetches data via HTTP.

Code

protected function errorStop($use, $print = TRUE) {
  if ($print) {
    foreach (libxml_get_errors() as $error) {
      switch ($error->level) {
        case LIBXML_ERR_WARNING:
        case LIBXML_ERR_ERROR:
          $type = 'warning';
          break;
        case LIBXML_ERR_FATAL:
          $type = 'error';
          break;
      }
      $args = array(
        '%error' => trim($error->message),
        '%num' => $error->line,
        '%code' => $error->code,
      );
      $message = t('%error on line %num. Error code: %code', $args);
      drupal_set_message($message, $type, FALSE);
    }
  }
  libxml_clear_errors();
  libxml_use_internal_errors($use);
}