You are here

public function FrxDataSource::parseXMLFile in Forena Reports 7.3

Same name and namespace in other branches
  1. 7.4 FrxDataSource.inc \FrxDataSource::parseXMLFile()
2 calls to FrxDataSource::parseXMLFile()
FrxDataSource::loadBlockFromDB in ./FrxDataSource.inc
FrxDataSource::loadBlockFromFile in ./FrxDataSource.inc

File

./FrxDataSource.inc, line 258
Class that defines default methods for access control in an FrxDataSource

Class

FrxDataSource
@file Class that defines default methods for access control in an FrxDataSource

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