protected function setCommonOptions($htmlOptions = false) { if ($this->options && is_array($this->options)) { if (isset($this->options['debug']) && $this->options['debug'] != 'false') { $this->debug = true; } $this->isFromShortCode = isset($this->options['fromshortcode']) && $this->options['fromshortcode'] === true; if (!isset($this->options['unbuffered'])) { $this->options['unbuffered'] = $this->isFromShortCode ? 'false' : 'true'; } if (isset($this->options['showColumns'])) { $this->showColumns = $this->options['showColumns']; } else { if (isset($this->options['show'])) { $this->showColumns = preg_split('/,/', $this->options['show'], -1, PREG_SPLIT_NO_EMPTY); } } if (isset($this->options['hideColumns'])) { $this->hideColumns = $this->options['hideColumns']; } else { if (isset($this->options['hide'])) { $this->hideColumns = preg_split('/,/', $this->options['hide'], -1, PREG_SPLIT_NO_EMPTY); } } if ($htmlOptions) { if (isset($this->options['class'])) { $this->htmlTableClass = $this->options['class']; } else { $this->htmlTableClass = $this->defaultTableClass; } if (isset($this->options['id'])) { $this->htmlTableId = $this->options['id']; } else { $this->htmlTableId = 'cftble_' . rand(); } if (isset($this->options['style'])) { $this->style = $this->options['style']; } } if (isset($this->options['filter'])) { require_once 'CF7FilterParser.php'; require_once 'DereferenceShortcodeVars.php'; $this->rowFilter = new CF7FilterParser(); $this->rowFilter->setComparisonValuePreprocessor(new DereferenceShortcodeVars()); $this->rowFilter->parseFilterString($this->options['filter']); if ($this->debug) { echo '<pre>\'' . $this->options['filter'] . "'\n"; print_r($this->rowFilter->tree); echo '</pre>'; } } else { if (isset($this->options['search'])) { require_once 'CF7SearchEvaluator.php'; $this->rowFilter = new CF7SearchEvaluator(); $this->rowFilter->setSearch($this->options['search']); } } } }
protected function setCommonOptions($htmlOptions = false) { if ($this->options && is_array($this->options)) { if (isset($this->options['debug']) && $this->options['debug'] != 'false') { $this->debug = true; } $this->isFromShortCode = isset($this->options['fromshortcode']) && $this->options['fromshortcode'] === true; if (!isset($this->options['unbuffered'])) { $this->options['unbuffered'] = $this->isFromShortCode ? 'false' : 'true'; } if (isset($this->options['showColumns'])) { $this->showColumns = $this->options['showColumns']; } else { if (isset($this->options['show'])) { $this->showColumns = preg_split('/,/', $this->options['show'], -1, PREG_SPLIT_NO_EMPTY); } } if (isset($this->options['hideColumns'])) { $this->hideColumns = $this->options['hideColumns']; } else { if (isset($this->options['hide'])) { $this->hideColumns = preg_split('/,/', $this->options['hide'], -1, PREG_SPLIT_NO_EMPTY); } } if ($htmlOptions) { if (isset($this->options['class'])) { $this->htmlTableClass = $this->options['class']; } else { $this->htmlTableClass = $this->defaultTableClass; } if (isset($this->options['id'])) { $this->htmlTableId = $this->options['id']; } else { $this->htmlTableId = 'cftble_' . rand(); } if (isset($this->options['style'])) { $this->style = $this->options['style']; } } $filters = array(); if (isset($this->options['filter'])) { require_once 'CF7FilterParser.php'; require_once 'DereferenceShortcodeVars.php'; $aFilter = new CF7FilterParser(); $aFilter->setComparisonValuePreprocessor(new DereferenceShortcodeVars()); $aFilter->parseFilterString($this->options['filter']); if ($this->debug) { echo '<pre>\'' . $this->options['filter'] . "'\n"; print_r($aFilter->tree); echo '</pre>'; } $filters[] = $aFilter; } if (isset($this->options['search'])) { require_once 'CF7SearchEvaluator.php'; $aFilter = new CF7SearchEvaluator(); $aFilter->setSearch($this->options['search']); $filters[] = $aFilter; } if (isset($this->options['cfilter'])) { if (function_exists($this->options['cfilter'])) { require_once 'CFDBFunctionEvaluator.php'; $aFilter = new CFDBFunctionEvaluator(); $aFilter->setFunction($this->options['cfilter']); $filters[] = $aFilter; } else { if (class_exists($this->options['cfilter'])) { require_once 'CFDBClassEvaluator.php'; $aFilter = new CFDBClassEvaluator(); $aFilter->setClassName($this->options['cfilter']); $filters[] = $aFilter; } } } $numFilters = count($filters); if ($numFilters == 1) { $this->rowFilter = $filters[0]; } else { if ($numFilters > 1) { require_once 'CFDBCompositeEvaluator.php'; $this->rowFilter = new CFDBCompositeEvaluator(); $this->rowFilter->setEvaluators($filters); } } if (isset($this->options['headers'])) { // e.g. "col1=Column 1 Display Name,col2=Column2 Display Name" $headersList = preg_split('/,/', $this->options['headers'], -1, PREG_SPLIT_NO_EMPTY); if (is_array($headersList)) { $this->headers = array(); foreach ($headersList as $nameEqualValue) { $nameEqualsValueArray = explode('=', $nameEqualValue, 2); // col1=Column 1 Display Name if (count($nameEqualsValueArray) >= 2) { $this->headers[$nameEqualsValueArray[0]] = $nameEqualsValueArray[1]; } } } } } }