Beispiel #1
0
 function __construct(READER $rdr, LOGGROUP $grp, DATAFilter $filter, &$opts = NULL)
 {
     if ($rdr instanceof CACHEReader) {
         $this->skip = true;
     } else {
         $this->skip = false;
         parent::__construct($rdr->GetGroupSize($grp), $opts);
     }
 }
Beispiel #2
0
 function __construct(READER $rdr, LOGGROUP $grp, DATAFilter $filter, &$opts = NULL)
 {
     if ($rdr instanceof CACHEReader) {
         $this->skip = true;
     } else {
         $this->skip = false;
         $this->filters = array();
         foreach ($opts['extractors'] as $ext => &$items) {
             $config =& $opts['config'][$ext];
             $filter_class = $config['filter'];
             ADEI::RequireClass("extractors/{$filter_class}", true);
             $this->filters[$ext] = array();
             foreach ($items as $item => $mask) {
                 $this->filters[$ext][$item] = new $filter_class($mask, $config);
             }
         }
         $this->mappings = $opts['mappings'];
         $mask = $filter->GetItemMask();
         if ($mask && !$mask->IsFull()) {
             $this->check_masked = true;
             $this->cur_indexes = array();
             $i = 0;
             foreach ($mask->ids as $id) {
                 $this->cur_indexes[$id] = $i++;
             }
         } else {
             $this->check_masked = false;
             $this->cur_indexes = range(0, $rdr->GetGroupSize($grp) - 1);
         }
         if ($opts['mask'] && !$opts['mask']->IsFull()) {
             $this->real_indexes = array();
             $i = 0;
             foreach ($opts['mask']->ids as $id) {
                 $this->real_indexes[$id] = $i++;
             }
         } else {
             $this->real_indexes = range(0, $rdr->GetGroupSize($grp) - 1);
         }
         $this->remove = sizeof($this->cur_mask) - sizeof($this->real_mask);
         if ($this->remove < 0) {
             $this->remove = 0;
         }
     }
 }
Beispiel #3
0
 function __construct(READER $rdr, LOGGROUP $grp, DATAFilter $filter, &$opts = NULL)
 {
     if ($rdr instanceof CACHEReader) {
         $this->skip = true;
     } else {
         $this->skip = false;
         $filter_class = $opts['filter'];
         if (!(include_once "item/" . strtolower($filter_class) . ".php")) {
             if (!isset($opts['filter'])) {
                 throw new ADEIException(translate("No item filter is configured"));
             } else {
                 throw new ADEIException(translate("Unsupported item filter is configured: \"%s\"", $filter_class));
             }
         }
         $this->filter = new $filter_class($opts);
         $mask = $filter->GetItemMask();
         if ($mask && !$mask->IsFull()) {
             $this->check_masked = true;
         } else {
             $this->check_masked = false;
         }
         if (isset($opts['item_mask'])) {
             $this->indexes = array();
             $key = array();
             $re = array();
             if (is_array($opts['item_mask'])) {
                 if (is_array($opts['item_mask'][0])) {
                     $checks = $opts['item_mask'];
                 } else {
                     $checks = array($opts['item_mask']);
                 }
             } else {
                 $re = $opts['item_mask'];
                 if ($mask) {
                     $checks = false;
                     $i = 0;
                     foreach ($mask->ids as $id) {
                         if (preg_match($re, $id)) {
                             $this->indexes[$i] = $id;
                         }
                         $i++;
                     }
                 } else {
                     $checks = array(array("key" => id, "items" => $re));
                 }
             }
             if ($checks) {
                 $items = $rdr->GetItemList($grp, $mask ? $mask : new MASK());
                 $i = 0;
                 foreach ($items as &$item) {
                     $matched = true;
                     foreach ($checks as $check) {
                         if (!preg_match($check['items'], $item[$check['key']])) {
                             $matched = false;
                             break;
                         }
                     }
                     if ($matched) {
                         $this->indexes[$i] = $item["id"];
                     }
                     $i++;
                 }
             }
         } else {
             if ($mask && !$mask->IsFull()) {
                 $this->indexes = $mask->ids;
             } else {
                 $this->indexes = range(0, $rdr->GetGroupSize($grp) - 1);
             }
         }
     }
 }