You are here

protected function FeedsProcessor::exportObjectVars in Feeds 7.2

Returns a string representation of an object or array for log messages.

Parameters

object|array $object: The object to convert.

Return value

string The sanitized string representation of the object.

2 calls to FeedsProcessor::exportObjectVars()
FeedsProcessor::createLogEntry in plugins/FeedsProcessor.inc
Creates a log entry for when an exception occurred during import.
FeedsProcessor::createLogMessage in plugins/FeedsProcessor.inc
DEPRECATED: Creates a log message for exceptions during import.

File

plugins/FeedsProcessor.inc, line 1475
Contains FeedsProcessor and related classes.

Class

FeedsProcessor
Abstract class, defines interface for processors.

Code

protected function exportObjectVars($object) {
  include_once DRUPAL_ROOT . '/includes/utility.inc';
  $out = is_array($object) ? $object : get_object_vars($object);
  $out = array_filter($out, 'is_scalar');
  foreach ($out as $key => $value) {
    if (is_string($value)) {
      if (function_exists('mb_check_encoding') && !mb_check_encoding($value, 'UTF-8')) {
        $value = utf8_encode($value);
      }
      $out[$key] = truncate_utf8($value, 100, FALSE, TRUE);
    }
  }
  if (is_array($object)) {
    return check_plain(drupal_var_export($out));
  }
  return check_plain(drupal_var_export((object) $out));
}