function frontend() { global $vars, $get, $post; $titlestr = PluginIncludex::get_titlestr($this->inclpage, $this->options['titlestr'][1]); $title = PluginIncludex::get_title($this->inclpage, $titlestr, $this->options['title'][1]); if ($this->error != "") { return; } // because included page would use these variables. $tmp = $vars['page']; $get['page'] = $post['page'] = $vars['page'] = $this->inclpage; if (function_exists('convert_filter')) { $this->lines = convert_filter($this->lines); // plus } $body = convert_html($this->lines); $get['page'] = $post['page'] = $vars['page'] = $tmp; if ($this->error != "") { return; } $footer = ''; if ($this->options['permalink'][1] !== false) { $linkstr = $this->make_inline($this->options['permalink'][1]); $footer = '<p class="permalink">' . make_pagelink($this->inclpage, $linkstr) . '</p>'; } return $title . "\n" . $body . $footer; }
function r_metalines($page, $detected = false) { if (array_key_exists($page, $this->visited)) { return array(); } if (!is_page($page)) { return array(); } $this->visited[$page] = ''; $lines = $this->get_source($page); $multiline = 0; $metalines = array(); foreach ($lines as $i => $line) { // multiline plugin. refer lib/convert_html if (defined('PKWKEXP_DISABLE_MULTILINE_PLUGIN_HACK') && PKWKEXP_DISABLE_MULTILINE_PLUGIN_HACK === 0) { $matches = array(); if ($multiline < 2) { if (preg_match('/^#([^\\(\\{]+)(?:\\(([^\\r]*)\\))?(\\{*)/', $line, $matches)) { $multiline = strlen($matches[3]); } } else { if (preg_match('/^\\}{' . $multiline . '}$/', $line, $matches)) { $multiline = 0; } continue; } } // fromhere if ($this->options['page'][1] == $page && !$detected) { if (preg_match('/^#' . $this->plugin . '/', $line, $matches)) { $detected = true; continue; } } if (preg_match($this->conf['def_headline'], $line, $matches)) { $depth = strlen($matches[1]); $anchor = '#' . $this->make_heading($line); // *** [id] is removed from $line $headline = trim($line); $metalines[] = array(page => $page, headline => $headline, anchor => $anchor, depth => $depth, linenum => $i, fromhere => $detected); continue; } if (preg_match($this->conf['def_include'], $line, $matches)) { $args = csv_explode(',', $matches[1]); $inclpage = array_shift($args); $options = array(); foreach ($args as $arg) { list($key, $val) = array_pad(explode('=', $arg, 2), 2, true); $options[$key] = $val; } $inclpage = get_fullname($inclpage, $page); if (!$this->is_page($inclpage)) { continue; } // $anchor = PluginIncludex::get_page_anchor($inclpage) $anchor = 'z' . md5($inclpage); $anchor = '#' . htmlspecialchars($anchor); if (exist_plugin('includex') & is_callable(array('PluginIncludex', 'get_titlestr'))) { $titlestr = PluginIncludex::get_titlestr($inclpage, $options['titlestr']); } else { $titlestr = $inclpage; } $metalines[] = array(page => $inclpage, headline => $titlestr, anchor => $anchor, depth => 0, linenum => $i, fromhere => $detected); $metalines = array_merge($metalines, $this->r_metalines($inclpage, $detected)); continue; } if (preg_match($this->conf['def_title'], $line, $matches)) { $title = $matches[1]; $this->visited[$page] = $title; continue; } } return $metalines; }