'Arthur Lobert', 'email' => 'arthur.lobert@thalesgroup.com', 'date' => '2010_09_01', 'name' => 'newsboard', 'desc' => '', 'url' => 'http://www.dokuwiki.org/plugin:newsboard', ); } function connectTo($mode) { $this->Lexer->addSpecialPattern('{{newsboard.*?}}',$mode,'plugin_newsboard'); } function check_arg($match){ $check = preg_split("/>/",$match, -1 ,PREG_SPLIT_DELIM_CAPTURE); if ($check[0] == "") return substr($match, 1, strlen($match) - 1); else return false; } function minmaj($match){ $ret = 0; switch ($match) { case "all": $ret = RECENTS_SKIP_DELETED; break; //default : major default: $ret = RECENTS_SKIP_DELETED | RECENTS_SKIP_MINORS ; break; } return $ret; } function nb_arg($nbr){ $nb = (int) $nbr; if ($nb < 1) $nbr = '10'; return ($nbr); } // function parse_ligne(); function handle($match, $state, $pos, &$handler){ $match = html_entity_decode(substr($match, 11, -2)); $match = $this->check_arg($match); if ($match){ $arg = preg_split("/\|/",$match, -1 ,PREG_SPLIT_DELIM_CAPTURE); $ns = $arg[0]; if ($ns[0] == ':') $ns = substr($ns, 1); $change = $this->minmaj($arg[1]); $nbr = $this->nb_arg($arg[2]); $modif = getRecents(0, $nbr, $ns, $change); return ($modif); } else{ return false; } } function get_titre($text) { $ignore = 0; $tab = preg_split("/======/",$text ,-1,PREG_SPLIT_DELIM_CAPTURE); if ($tab[2] != Null) return ($tab[1]); return (0); } function cut_titre($text, $titre){ return (str_replace('======'.$titre.'======', ' ', $text)); } function get_image($page) { $i = 0; $text = rawWiki($page); $tab = preg_split("/(\{\{|\}})/",$text, -1 ,PREG_SPLIT_DELIM_CAPTURE); while ($tab[$i]) { if ($tab[$i] == "{{" && preg_match("/newsboard>/", $tab[$i + 1]) == 0) return $tab[$i].$tab[$i+1].$tab[$i+2]; $i++; } return 0; } function cut_text($text){ return (str_replace('/', ' / ', $text)); } function render($mode, &$renderer, $data) { foreach ($data as $tic): $page = $tic[id]; $text = rawWikiSlices('1-500', $page); $text = $this->cut_text($text[1]); $titre = $this->get_titre($text); $text = $this->cut_titre($text, $titre); $media = $this->get_image($page); if ($media) $image =" "; else $image = 0; if (plugin_isdisabled('wrap') || (!$wrap = plugin_load('syntax', 'wrap_div'))) { msg('missing_wrapplugin', -1); return false; } $data[0] = '1'; $data[1] = 'round box 600px center'; $wrap->render($mode, &$renderer, $data); $renderer->doc .="
". $image."
| ";
}
else
$renderer->doc .="
";
$data[0] = '3';
$data[1] = $text;
$wrap->render($mode, &$renderer, $data);
$renderer->doc .= "
|