function toString($limit = 0) { if (empty($this->rows)) { $this->error = 'Pages not found under: ' . $this->base . '/'; return FALSE; } $rows = $this->rows; $source = array(); $count = count($this->rows); $limit = intval($limit); if ($limit != 0) { $limit = max(1, $limit); } if ($limit != 0 && $count > $limit) { $source[] = str_replace(array('$1', '$2'), array($count, $limit), $this->func->plugin_tracker_message('msg_limit')) . "\n"; $rows = array_slice($this->rows, 0, $limit); } // Loading template $header = $body = array(); foreach (xpwiki_plugin_tracker::plugin_tracker_get_source($this->config->page . '/' . $this->list) as $line) { if (preg_match('/^\\|(.+)\\|[hfc]$/i', $line)) { // TODO: Why c and f here $header[] = $line; // Table header, footer, and decoration } else { $body[] = $line; // The others } } foreach ($header as $line) { $source[] = preg_replace_callback('/\\[([^\\[\\]]+)\\]/', array(&$this, '_replace_title'), $line); } foreach ($rows as $row) { if (!$this->cont['PLUGIN_TRACKER_LIST_SHOW_ERROR_PAGE'] && !$row['_match']) { continue; } $this->_items = $row; foreach ($body as $line) { if (ltrim($line) != '') { $this->_escape = $line[0] == '|' || $line[0] == ':'; // The first letter $line = preg_replace_callback('/\\[([^\\[\\]]+)\\]/', array(&$this, '_replace_item'), $line); } $source[] = $line; } } return implode('', $source); }
function plugin_tracker_list_init() { parent::plugin_tracker_init(); }