You are here

public function FrxDataProvider::parseXMLFile in Forena Reports 7.2

Same name and namespace in other branches
  1. 6.2 FrxDataProvider.inc \FrxDataProvider::parseXMLFile()
1 call to FrxDataProvider::parseXMLFile()
FrxDataProvider::load_block in ./FrxDataProvider.inc
Default block load Loads the data block based on the block name from the file system. The classes that are derived from this will set the block_ext property, which in most cases is .sql but might be something different. The load of the block file…

File

./FrxDataProvider.inc, line 142
Class that defines default methods for access control in an FrxDataProvider

Class

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

Code

public function parseXMLFile($contents) {
  $comment = $this->comment_prefix;
  $trim = $this->comment_suffix;
  $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,
  );
}