includes/tagcloud.php
changeset 391 85f91037cd4f
parent 387 92664d2efab8
child 411 d1a95497b68f
equal deleted inserted replaced
390:9bcc185dc151 391:85f91037cd4f
   130    * @return string
   130    * @return string
   131    */
   131    */
   132    
   132    
   133   function make_html($span_class = 'normal', $div_align = 'center')
   133   function make_html($span_class = 'normal', $div_align = 'center')
   134   {
   134   {
       
   135     global $lang;
   135     $html = array();
   136     $html = array();
   136     $max  = max($this->words);
   137     $max  = max($this->words);
   137     $size = $this->get_cloud_size();
   138     $size = $this->get_cloud_size();
   138     $inc = 0;
   139     $inc = 0;
   139     if ( count($this->words) > 0 )
   140     if ( count($this->words) > 0 )
   145         $percent = ( $popularity / $max ) * 100;
   146         $percent = ( $popularity / $max ) * 100;
   146         $index = $this->get_scale_class($percent);
   147         $index = $this->get_scale_class($percent);
   147         $newline = ( $inc == 5 ) ? "<br />" : '';
   148         $newline = ( $inc == 5 ) ? "<br />" : '';
   148         ( $inc == 5 ) ? $inc = 0 : null;
   149         ( $inc == 5 ) ? $inc = 0 : null;
   149         $url = makeUrlNS('Special', 'TagCloud/' . htmlspecialchars($word));
   150         $url = makeUrlNS('Special', 'TagCloud/' . htmlspecialchars($word));
   150         $s = ( $popularity != 1 ) ? 's' : '';
   151         $popstring = ( $popularity == 1 ) ? $lang->get('pagetools_tagcloug_tip_popularity_one') : $lang->get('pagetools_tagcloug_tip_popularity_plural', array('popularity' => $popularity));
   151         $html[] = "<span class='tc_word_{$span_class} tc_{$span_class}_index_{$index}'><a href='$url' title='$popularity page$s'>$word</a></span>"; // $newline";
   152         $html[] = "<span class='tc_word_{$span_class} tc_{$span_class}_index_{$index}'><a href='$url' title='$popstring'>$word</a></span>"; // $newline";
   152       }
   153       }
   153     }
   154     }
   154     $html = '<div style="text-align: ' . $div_align . '; margin: 0 auto; max-width: 400px;">' . implode("\n", $html) . '</div>';
   155     $html = '<div style="text-align: ' . $div_align . '; margin: 0 auto; max-width: 400px;">' . implode("\n", $html) . '</div>';
   155     return $html;
   156     return $html;
   156   }
   157   }