Implemented in cloud plugin since 2006-03-17.
As you can see in my sidebar, I´m using the plugin:cloud plugin by Esther Brunner.
Hence, due to the speaking in tongues issue in this wiki, using stopwords of just one language is not enough. Copying all stopwords would have been an option but with some drawbacks:
So I added some lines to the code to make it also load a local stopwords file
conf/stopwords.txt
with the same syntax like the original ones (one stopword per line).
Here are the modified functions of the cloud syntax.php. Changes are marked with
// CLOUD-MOD
function render($mode, &$renderer, $data)
function render($mode, &$renderer, $data) { global $ID; global $INFO; global $conf; if($mode == 'xhtml'){ if (!is_numeric($data)) $num = 50; else $num = $data; // prevent caching to ensure the included pages are always fresh $renderer->info['cache'] = false; // load index files $idx = file($conf['cachedir'].'/index.idx'); $word_idx = file($conf['cachedir'].'/word.idx'); $wcount = count($word_idx); // load stopwords $swfile = DOKU_INC.'inc/lang/'.$conf['lang'].'/stopwords.txt'; if(@file_exists($swfile)) $stopwords = file($swfile); else $stopwords = array(); // CLOUD-MOD: load extra local stopwords $swfile = DOKU_INC.'conf/stopwords.txt'; if(@file_exists($swfile)) $stopwords = array_merge($stopwords,file($swfile)); // collect the frequency of the words $cloud = array(); for ($i = 0; $i < $wcount; $i++){ $key = trim($word_idx[$i]); if (is_int(array_search("$key\n",$stopwords))) $cloud[$key] = 0; else $cloud[$key] = count(explode(":", $idx[$i])); } // sort by frequency, then alphabetically arsort($cloud); $cloud = array_chunk($cloud, $num, true); $max = current($cloud[0]); $min = end($cloud[0]); $delta = ($max-$min)/8; ksort($cloud[0]); // and render the cloud $renderer->doc .= '<div id="cloud">'; foreach ($cloud[0] as $word => $size){ if ($size < $min+round($delta)) $class = 'cloud1'; elseif ($size < $min+round(2*$delta)) $class = 'cloud2'; elseif ($size < $min+round(3*$delta)) $class = 'cloud3'; elseif ($size < $min+round(5*$delta)) $class = 'cloud4'; else $class = 'cloud5'; $renderer->doc .= '<a href="'.wl($word,'do=search').'" class="'.$class.'">'.$word.'</a> '; } $renderer->doc .= '</div>'; return true; } return false; } }
This should be all, reload you page, be sure to purge the cache and take a look.