print_cloudy(); */ class cloudy { var $my_cloudy_text; var $word_list; var $range; var $wp_conn; // Deprecated -- but left in place so we don't break existing code. function make_cloudy () { global $wpdb; // This is the number of words to have in your cloud $number_of_words = 50; // This is the minimum length of a word before it is included in the cloud $_min_length_of_words = 4; // This is the list of words to exclude from your cloud $exclude_words = array( '@ than @', '@ them @', '@ those @', '@http://@', '@ about @', '@ also @', '@ because @', '@ been @', '@ can\'t @', '@ could @', '@ doesn\'t @', '@ don\'t @', '@ even @', '@ from @', '@ going @', '@ have @', '@ here @', '@ http_request @', '@ into @', '@ i\'ll @', '@ i\'ve @', '@ it\'s @', '@ just @', '@ like @', '@ look @', '@ make @', '@ many @', '@ more @', '@ much @', '@ must @', '@ need @', '@ should @', '@ some @', '@ someone @', '@ such @', '@ the @', '@ take @', '@ that @', '@ their @', '@ then @', '@ there @', '@ these @', '@ they @', '@ this @', '@ this @', '@ want @', '@ well @', '@ what @', '@ when @', '@ where @', '@ which @', '@ will @', '@ with @', '@ without @', '@ would @', '@ your @' ); // Various punctuation that should be filtered from the cloud $exclude_symbs = array('@[0-9]@','@\.@','@\,@','@\:@','@"@','@\?@','@\(@','@\)@','@\!@','@\/@'); // Reset our class globals and other variables $this->my_cloudy_text = ''; $this->word_list = array(); $cnt = 0; // Get Array of Content $words = $wpdb->get_col("select post_content from " . $wpdb->posts); $words = implode(' ', $words); // Make it a string $words = strip_tags($words); // Clean HTML tags $words = strtolower($words); // Make all words lower case $words = preg_replace($exclude_symbs, ' ', $words); // Strip excluded symbols $words = preg_replace($exclude_words, ' ', $words); // Strip excluded words $words = preg_replace('/\s\s+/', ' ', $words); // Strip extra white space $words = explode(' ', $words); // Turn it back into an array $words = array_count_values($words); // Count word usage arsort($words); // Sort the array by usage count // Here we build our smaller array of words that will be used. foreach ($words as $key => $val) { if (strlen($key) >= $_min_length_of_words && $cnt < $number_of_words) { $this->word_list[$key] = $val; $cnt++; } } // Get the high and low, and calculate the range. // This is used to weight the size of the words $low_count = end($this->word_list); $high_count = reset($this->word_list); $this->range = ($high_count - $low_count) / 5; // Clear out the big array of words. $words = ''; // Sort the array alphabetically for the cloud ksort($this->word_list); // Build the cloud's HTML foreach ($this->word_list as $key => $val) { $font_size = 100; if ($val >= $this->range*2) $font_size = 150; if ($val >= $this->range*3) $font_size = 200; if ($val >= $this->range*4) $font_size = 250; if ($val >= $this->range*5) $font_size = 300; // Brian Damage - This is where I made my edit. Be sure to put your URL in place of mine in the command below. $this->my_cloudy_text .= "$key "; $cnt++; } } // Print the word cloud function print_cloudy () { $this->make_cloudy(); echo $this->my_cloudy_text; } } ?>