You are here

public function FrxDataSource::parseXMLFile in Forena Reports 7.5

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

File

src/Driver/FrxDataSource.php, line 212
Class that defines default methods for access control in an FrxDataSource

Class

FrxDataSource

Namespace

Drupal\forena\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),
  );
}