You are here

protected function views_xml_backend_plugin_query_xml::errorStop in Views XML Backend 7

Same name and namespace in other branches
  1. 6 views_xml_backend_plugin_query_xml.inc \views_xml_backend_plugin_query_xml::errorStop()

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.

1 call to views_xml_backend_plugin_query_xml::errorStop()
views_xml_backend_plugin_query_xml::execute in ./views_xml_backend_plugin_query_xml.inc
Executes the query and fills the associated view object with according values.

File

./views_xml_backend_plugin_query_xml.inc, line 459
Contains views_xml_backend_plugin_query_xml.

Class

views_xml_backend_plugin_query_xml
@file Contains views_xml_backend_plugin_query_xml.

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;
      }
      $message = t('%error on line %num. Error code: %code', array(
        '%error' => trim($error->message),
        '%num' => $error->line,
        '%code' => $error->code,
      ));
      drupal_set_message($message, $type, FALSE);
    }
  }
  libxml_clear_errors();
  libxml_use_internal_errors($use);
}