Lexer->addSpecialPattern('<>',$mode,'plugin_credits'); } function handle($match, $state, $pos, Doku_Handler $handler) { preg_match('/<>/', $match,$matches); return array( $state, $matches[1]); } /** * Create output */ function render($mode, Doku_Renderer $renderer, $data) { if($mode == 'xhtml'){ $this->get_plugin_array(); list($state, $match) = $data; $match = trim($match); if($match && function_exists($match)) { $match($renderer,$this->plugins); } else { if($match == '~nodesc~') { $this->show_descriptions = false; } $this->_page($renderer); } return true; } return false; } /* 'text_weight'=> 'bold' 'email_text_size'=> '90%' 'font_family' sans-serif 'text_size' 90% */ function _get_configs($which) { global $conf; $settings = array( 'background_color'=>'#FFDD99', 'pop_up_color'=>'#006600', 'pop_up_weight'=>'normal', 'text_weight'=> 'bold','email_text_size'=> '95%','text_size'=>'90%', 'font_family'=>'Verdana,"Lucida Grande",Lucida,Helvetica,Arial,sans-serif', 'email_weight'=>'normal', 'text_color'=>'#333333', 'line_height'=>'1.25', 'pop_up_family' =>'Helvetica,Arial,sans-serif', 'title_string' => '

Plugins

', 'subtitle_string'=>'Credits', 'do_desc' => true ); if(isset ($conf['plugin']['credits'][$which])) return($conf['plugin']['credits'][$which]); else return $settings[$which]; } function mouseover() { $bgcolor = $this->_get_configs('background_color'); $text = $this->_get_configs('pop_up_color'); $pop_up_weight = $this->_get_configs('pop_up_weight'); $family = $this->_get_configs('pop_up_family'); $doc = ''; return $doc . "\n"; } function _page(&$renderer) { $text_weight = $this->_get_configs('text_weight'); $text_size = $this->_get_configs('text_size'); $email_size = $this->_get_configs('email_text_size'); $email_weight=$this->_get_configs('email_weight'); $line_height=$this->_get_configs('line_height'); $text_color=$this->_get_configs('text_color'); $family=$this->_get_configs('font_family'); $title=$this->_get_configs('title_string'); $subtitle=$this->_get_configs('subtitle_string'); if(!$this->show_descriptions) { $do_description = false; } else { $do_description=$this->_get_configs('do_desc'); } $renderer->doc .= $this->mouseover($renderer); $renderer->doc .= "
\n"; $renderer->doc .= $title; $renderer->doc .= $subtitle; $renderer->doc .= "
"; $id_count = 0; foreach($this->keys as $name) { $date = isset($this->plugins[$name]['date'])?$this->plugins[$name]['date']:"" ; $author = isset($this->plugins[$name]['author'])?$this->plugins[$name]['author']:"" ; if(!isset($this->plugins[$name]['email'])) { $this->plugins[$name]['email'] = str_replace(" ", "_",$author) . "@No_Email_Given"; } if(isset($this->plugins[$name]['email'])) { $remainder = ""; $desc = ""; if($do_description) { $desc = $this->plugins[$name]['desc']; } if(!empty($desc)) { $remainder = "
"; $remainder_id = ""; if($trunc_array = $this->truncate($desc)) { list($trunc, $rest) = $trunc_array; $id_count++; $remainder_id = 'remainderid_' . $id_count; $trunc = "$trunc " . '  ->   '; $remainder = "      " . $rest . '
'; $desc = $trunc; } } $address =credits_hide_email($this->plugins[$name]['email']); $email = "  $author\n"; } $renderer->doc .= "$name $email
"; if(!empty($remainder)) { $renderer->doc .= "    "; } $renderer->doc .= "$desc$remainder"; } $renderer->doc .= '
'; } function get_plugin_array() { foreach($this->types as $type) { $this->store_plugins($type); } $this->keys = array_keys($this->plugins); natcasesort($this->keys); } function store_plugins($type=""){ if(!$type) return; $plugins = plugin_list($type); foreach($plugins as $p){ if (!$po = plugin_load($type,$p)) continue; if(!method_exists($po,'getInfo')) continue; $info = $po->getInfo(); $this->plugins[$info['name']] = $info; unset($po); } } function truncate($str, $len=50) { $strL = strlen($str); if($strL > $len) { $trunc = substr($str,0,$len); $remainder = substr($str,$len); if(strlen($remainder) < 30) { return false; } return(array($trunc,$remainder)); } return false; } } function credits_hide_email($email) { $encode = ''; for ($x=0; $x < strlen($email); $x++) $encode .= '&#x' . bin2hex($email{$x}).';'; return $encode; } function alt_credits(&$renderer,$info) { foreach($info as $plugin=>$items) { $renderer->doc .= "$plugin
"; foreach($items as $name=>$value) { if($name == 'email') $value = credits_hide_email($value); $renderer->doc .= "$name: $value
"; } $renderer->doc .= '
'; } }