From b7709eae0dcb81df9eb668407b64f2cde38ba1f0 Mon Sep 17 00:00:00 2001 From: patdenice Date: Sat, 12 Jul 2008 14:57:24 +0000 Subject: [PATCH] Merge from branch-1_7 (r2432). Add triggers for category name (render_category_name). Add strip_tags for ALT attribute on category thumbnail. git-svn-id: http://piwigo.org/svn/trunk@2433 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/cat_list.php | 7 ++++++- include/category_cats.inc.php | 8 +++++++- include/functions_category.inc.php | 9 ++++++++- include/functions_html.inc.php | 21 ++++++++++++++++++++- 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/admin/cat_list.php b/admin/cat_list.php index b8407c2f8..2fa4ee25f 100644 --- a/admin/cat_list.php +++ b/admin/cat_list.php @@ -212,7 +212,12 @@ foreach ($categories as $category) $tpl_cat = array( - 'NAME' => $category['name'], + 'NAME' => + trigger_event( + 'render_category_name', + $category['name'], + 'admin_cat_list' + ), 'ID' => $category['id'], 'RANK' => $category['rank']*10, diff --git a/include/category_cats.inc.php b/include/category_cats.inc.php index 96b1aee58..c706ee496 100644 --- a/include/category_cats.inc.php +++ b/include/category_cats.inc.php @@ -224,6 +224,12 @@ if (count($categories) > 0) foreach ($categories as $category) { + $category['name'] = trigger_event( + 'render_category_name', + $category['name'], + 'subcatify_category_name' + ); + if ($page['section']=='recent_cats') { $name = get_cat_display_name_cache($category['uppercats'], null, false); @@ -239,7 +245,7 @@ if (count($categories) > 0) array( 'ID' => $category['id'], 'TN_SRC' => $thumbnail_src_of[$category['representative_picture_id']], - 'ALT' => $category['name'], + 'ALT' => strip_tags($category['name']), 'ICON' => $icon_ts, 'URL' => make_index_url( diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php index 721cc0038..0bca0897a 100644 --- a/include/functions_category.inc.php +++ b/include/functions_category.inc.php @@ -288,7 +288,14 @@ function display_select_categories($categories, { $option = str_repeat(' ', (3 * substr_count($category['global_rank'], '.'))); - $option.= '- '.$category['name']; + $option.= '- '; + $option.= strip_tags( + trigger_event( + 'render_category_name', + $category['name'], + 'display_select_categories' + ) + ); } $tpl_cats[ $category['id'] ] = $option; } diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php index 6f9e1fc5a..2578fc8c3 100644 --- a/include/functions_html.inc.php +++ b/include/functions_html.inc.php @@ -246,6 +246,13 @@ function get_cat_display_name($cat_informations, is_array($cat) or trigger_error( 'get_cat_display_name wrong type for category ', E_USER_WARNING ); + + $cat['name'] = trigger_event( + 'render_category_name', + $cat['name'], + 'get_cat_display_name' + ); + if ($is_first) { $is_first = false; @@ -320,6 +327,12 @@ SELECT id, name, permalink { $cat = $cache['cat_names'][$category_id]; + $cat['name'] = trigger_event( + 'render_category_name', + $cat['name'], + 'get_cat_display_name_cache' + ); + if ($is_first) { $is_first = false; @@ -430,7 +443,13 @@ function get_html_menu_category($categories, $selected_category) { $menu.= ' rel="up"'; } - $menu.= ' title="'.$title.'">'.$category['name'].''; + $menu.= ' title="'.$title.'">'; + $menu.= trigger_event( + 'render_category_name', + $category['name'], + 'get_html_menu_category' + ); + $menu.= ''; if ( $category['count_images']>0 ) {// at least one direct or indirect image