diff --git a/models/GenericTable.php b/models/GenericTable.php index a06b8ef..729d414 100644 --- a/models/GenericTable.php +++ b/models/GenericTable.php @@ -42,7 +42,7 @@ class GenericTable extends PageIndex // Should we create a page index? $this->items_per_page = !empty($options['items_per_page']) ? $options['items_per_page'] : 30; $this->needsPageIndex = !empty($this->items_per_page) && $this->recordCount > $this->items_per_page; - $this->index_class = isset($options['index_class']) ? $options['index_class'] : ''; + $this->index_class = $options['index_class'] ?? ''; // Figure out where to start. $this->start = empty($options['start']) || !is_numeric($options['start']) || $options['start'] < 0 || $options['start'] > $this->recordCount ? 0 : $options['start']; @@ -50,10 +50,6 @@ class GenericTable extends PageIndex // Let's bear a few things in mind... $this->base_url = $options['base_url']; - // This should be set at all times, too. - if (empty($options['no_items_label'])) - $options['no_items_label'] = ''; - // Gather parameters for the data gather function first. $parameters = [$this->start, $this->items_per_page, $options['sort_order'], $options['sort_direction']]; if (!empty($options['get_data_params']) && is_array($options['get_data_params'])) @@ -77,18 +73,18 @@ class GenericTable extends PageIndex // Not a single row in sight? if (empty($rows)) - $this->body = $options['no_items_label']; + $this->body = $options['no_items_label'] ?? ''; // Otherwise, parse it all! else $this->parseAllRows($rows, $options); // Got a title? - $this->title = isset($options['title']) ? htmlentities($options['title']) : ''; - $this->title_class = isset($options['title_class']) ? $options['title_class'] : ''; + $this->title = $options['title'] ?? ''; + $this->title_class = $options['title_class'] ?? ''; // Maybe even a form or two? - $this->form_above = isset($options['form_above']) ? $options['form_above'] : (isset($options['form']) ? $options['form'] : null); - $this->form_below = isset($options['form_below']) ? $options['form_below'] : (isset($options['form']) ? $options['form'] : null); + $this->form_above = $options['form_above'] ?? $options['form'] ?? null; + $this->form_below = $options['form_below'] ?? $options['form'] ?? null; } private function generateColumnHeaders($options) diff --git a/templates/FormView.php b/templates/FormView.php index 7ab40ff..47c52ec 100644 --- a/templates/FormView.php +++ b/templates/FormView.php @@ -25,7 +25,7 @@ class FormView extends SubTemplate if (!empty($this->title)) echo '
-

', $this->title, '

'; +

', htmlspecialchars($this->title), '

'; foreach ($this->_subtemplates as $template) $template->html_main();