Lexer->addSpecialPattern('{{INLINETOC}}', $mode, 'plugin_inlinetoc'); $this->Lexer->addSpecialPattern('{{INLINETOC>.+?}}', $mode, 'plugin_inlinetoc'); } /** * Handle the match */ function handle($match, $state, $pos, &$handler) { $begin_level = -1; $end_level = -1; $autons = false; $namespace = ''; $spacer = strpos($match, '>'); $param_ns = 'ns'; // param namespace $param_bl = 'bl:'; // param begin level $param_el = 'el:'; // param end level if ($spacer > 0 ) // check if contains parmeters { $param_string = preg_split('/>/u', $match, 2); $params = preg_split('/ /u', $param_string[1]); foreach($params as &$param) { dbglog("param: $param"); if ($param_ns === substr($param, 0, strlen($param_ns))) // check if should use namespace { dbglog("contains namespace"); $namespace = substr($param, strlen($param_ns) + 1); if ($namespace === false or $namespace === '') { dbglog("use autons"); $autons = true; } dbglog("ns: |$namespace|"); } else if ($param_bl === substr($param, 0, strlen($param_bl))) // check if should use begin level { dbglog("contains begin level"); $begin = intval(substr($param, strlen($param_bl))); } else if ($param_el === substr($param, 0, strlen($param_el))) // check if should use end level { dbglog("contains end level"); $end = intval(substr($param, strlen($param_el))); } } } dbglog($namespace, "namespace:"); return array( 'begin' => $begin, 'end' => $end, 'autons' => $autons, 'namespace' => $namespace); } /** * Add placeholder to cached page (will be replaced by action component) */ function render($mode, &$renderer, $data) { dbglog($data, "render data"); $begin_level = $data['begin']; $end_level = $data['end']; $autons = $data['autons']; $namespace = $data['namespace']; $renderer->doc .= ""; } }