You are here

public function DriverBase::parseXMLFile in Forena Reports 8

Parse XML File contents into contents.

Parameters

$contents:

Return value

array

1 call to DriverBase::parseXMLFile()
DriverBase::loadBlockFromFile in src/FrxPlugin/Driver/DriverBase.php

File

src/FrxPlugin/Driver/DriverBase.php, line 253
Class that defines default methods for access control in an DriverBase

Class

DriverBase

Namespace

Drupal\forena\FrxPlugin\Driver

Code

public function parseXMLFile($contents) {
  $comment = $this->comment_prefix;
  $trim = '->';
  $lines = explode("\n", $contents);
  $cnt = count($lines);
  $access = '';
  $i = 0;
  $block = '';
  $data = '';
  while ($i < $cnt) {
    $l = trim($lines[$i], "\r");
    @(list($d, $c) = explode($comment, $l, 2));
    if ($trim) {
      $c = trim($c, $trim);
    }
    if ($c) {
      list($a, $o) = explode('=', $c, 2);
      $a = trim($a);
      if ($a && $o) {
        switch ($a) {
          case 'ACCESS':
            $access = trim($o);
            break;
          default:
        }
      }
    }
    if (strpos($l, $comment) !== 0) {
      $data .= "{$l}\n";
    }
    $i++;
  }
  return array(
    'access' => $access,
    'source' => $data,
    'tokens' => $this
      ->tokens($data),
  );
}