Changeset 2118


Ignore:
Timestamp:
Oct 2, 2007, 7:42:22 AM (17 years ago)
Author:
rvelices
Message:
  • merge r 2117 from trunk (render_category_description and render_category_literal_description events refactoring)
  • fix admin multiview plugin
Location:
branches/branch-1_7
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/branch-1_7/include/category_cats.inc.php

    r2094 r2118  
    179179  }
    180180
    181   // add default event handler for rendering category literal description
    182   add_event_handler('render_category_literal_description',
    183     create_function('$d',
    184       'return strip_tags($d, \'<a><br><p><b><i><small><strong><font>\');'));
    185 
    186181  trigger_action('loc_begin_index_category_thumbnails', $categories);
    187182  if ($conf['subcatify'])
  • branches/branch-1_7/include/common.inc.php

    r2112 r2118  
    173173
    174174// template instance
    175 if 
     175if
    176176  (
    177       defined('IN_ADMIN') and IN_ADMIN and 
     177      defined('IN_ADMIN') and IN_ADMIN and
    178178      isset($user['admin_template']) and
    179179      isset($user['admin_theme'])
     
    262262
    263263// default event handlers
     264add_event_handler('render_category_literal_description', 'render_category_literal_description');
     265add_event_handler('render_category_description', 'render_category_description');
    264266add_event_handler('render_comment_content', 'htmlspecialchars');
    265267add_event_handler('render_comment_content', 'parse_comment_content');
  • branches/branch-1_7/include/functions_category.inc.php

    r2069 r2118  
    157157    }
    158158  }
    159   global $conf;
    160   if ( !( $conf['allow_html_descriptions'] and
    161           preg_match('/<(div|br|img|script).*>/i', $cat['comment']) ) )
    162   {
    163     $cat['comment'] = nl2br(@$cat['comment']);
    164   }
    165159
    166160  $upper_ids = explode(',', $cat['uppercats']);
     
    446440      $cat_nb_images = 0;
    447441    }
    448    
     442
    449443    //at least one image direct or indirect
    450444    $display_text.= l10n_dec('image_available', 'images_available', $cat_count_images);
  • branches/branch-1_7/include/functions_html.inc.php

    r2069 r2118  
    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?>
  • branches/branch-1_7/include/section_init.inc.php

    r1997 r2118  
    205205      $page,
    206206      array(
    207         'comment'           => $page['category']['comment'],
     207        'comment'           =>
     208            trigger_event(
     209              'render_category_description',
     210              $page['category']['comment']
     211            ),
    208212        'title'             =>
    209213          get_cat_display_name($page['category']['upper_names'], '', false),
     
    332336      $page,
    333337      array(
    334         'title' => $lang['search_result'],
     338        'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
     339                  .$lang['search_result'].'</a>',
    335340        )
    336341      );
     
    386391      $page,
    387392      array(
    388         'title' => '<a href="'.duplicate_index_url().'">'
     393        'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
    389394                  .$lang['recent_pics_cat'].'</a>',
    390395        'items' => array_from_query($query, 'id'),
     
    424429      $page,
    425430      array(
    426         'title' => '<a href="'.duplicate_index_url().'">'
     431        'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
    427432                  .$conf['top_number'].' '.$lang['most_visited_cat'].'</a>',
    428433        'items' => array_from_query($query, 'id'),
     
    450455      $page,
    451456      array(
    452         'title' => '<a href="'.duplicate_index_url().'">'
     457        'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
    453458                  .$conf['top_number'].' '.$lang['best_rated_cat'].'</a>',
    454459        'items' => array_from_query($query, 'id'),
     
    473478      $page,
    474479      array(
    475         'title' => '<a href="'.duplicate_index_url().'">'
     480        'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
    476481                    .$lang['random_cat'].'</a>',
    477482        'items' => array_from_query($query, 'id'),
  • branches/branch-1_7/index.php

    r2113 r2118  
    297297    'cat_infos.comment',
    298298    array(
    299       'COMMENTS' =>
    300         trigger_event('render_category_description', $page['comment'])
     299      'COMMENTS' => $page['comment']
    301300      )
    302301    );
  • branches/branch-1_7/plugins/admin_multi_view/is_admin.inc.php

    r2017 r2118  
    1212  {
    1313    list($user['template'], $user['theme']) = explode('/', $theme);
     14    unset( $user['admin_template'], $user['admin_theme']);
    1415  }
    1516  $lang = pwg_get_session_var( 'multiview_lang', '' );
Note: See TracChangeset for help on using the changeset viewer.