Ignore:
Timestamp:
Oct 2, 2007, 7:38:54 AM (17 years ago)
Author:
rvelices
Message:
  • render_category_description and render_category_literal_description events refactoring
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_html.inc.php

    r2070 r2117  
    5959  {
    6060    // Use MySql date in order to standardize all recent "actions/queries"
    61     list($page['get_icon_cache']['unix_timestamp']) = 
     61    list($page['get_icon_cache']['unix_timestamp']) =
    6262      mysql_fetch_array(pwg_query('select UNIX_TIMESTAMP(CURRENT_DATE)'));
    6363  }
     
    456456      $menu.= "\n".'<span class="';
    457457      // at least one image in this category -> class menuInfoCat
    458       $menu.= ($category['nb_images'] > 0 ? "menuInfoCat" 
     458      $menu.= ($category['nb_images'] > 0 ? "menuInfoCat"
    459459                                          : "menuInfoCatByChild").'"';
    460460      $menu.= ' title=" '.$title.'">';
     
    736736function set_span_class($count)
    737737{
    738   if ($count > 1) 
    739   { 
     738  if ($count > 1)
     739  {
    740740    return 'plural';
    741741  }
    742   return ( $count == 0 ) ? 'zero':'one';
     742  return ( $count == 0 ) ? 'zero':'one';
     743}
     744
     745/** returns the category comment for rendering in html.
     746 * this is an event handler. don't call directly
     747 */
     748function render_category_description($desc)
     749{
     750  global $conf;
     751  if ( !( $conf['allow_html_descriptions'] and
     752          preg_match('/<(div|br|img|script).*>/i', $desc) ) )
     753  {
     754    $desc = nl2br($desc);
     755  }
     756  return $desc;
     757}
     758
     759/** returns the category comment for rendering in html textual mode (subcatify)
     760 * this is an event handler. don't call directly
     761 */
     762function render_category_literal_description($desc)
     763{
     764  return strip_tags($desc, '<span><p><a><br><b><i><small><big><strong><em>');
    743765}
    744766?>
Note: See TracChangeset for help on using the changeset viewer.