diff options
author | patdenice <patdenice@piwigo.org> | 2008-07-12 14:27:22 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2008-07-12 14:27:22 +0000 |
commit | 3e8dd7da9b095d6e9a5ba69515cbeb075fc214b6 (patch) | |
tree | 277bda41e6d424a0995cba5a01648776b24cf398 | |
parent | be7bb150c2157948cc6e00324166059d03b14e16 (diff) |
Add triggers for category name (render_category_name).
Add strip_tags for ALT attribute on category thumbnail.
git-svn-id: http://piwigo.org/svn/branches/branch-1_7@2432 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | admin/cat_list.php | 7 | ||||
-rw-r--r-- | include/category_cats.inc.php | 16 | ||||
-rw-r--r-- | include/functions_category.inc.php | 9 | ||||
-rw-r--r-- | include/functions_html.inc.php | 21 |
4 files changed, 48 insertions, 5 deletions
diff --git a/admin/cat_list.php b/admin/cat_list.php index 2b805b105..a54a70491 100644 --- a/admin/cat_list.php +++ b/admin/cat_list.php @@ -241,7 +241,12 @@ foreach ($categories as $category) $template->assign_block_vars( 'categories.category', 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 dabe072c4..d87efd522 100644 --- a/include/category_cats.inc.php +++ b/include/category_cats.inc.php @@ -185,6 +185,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); @@ -200,7 +206,7 @@ if (count($categories) > 0) 'categories.category', array( 'SRC' => $thumbnail_src_of[$category['representative_picture_id']], - 'ALT' => $category['name'], + 'ALT' => strip_tags($category['name']), 'TITLE' => l10n('hint_category'), 'ICON' => $icon_ts, @@ -249,11 +255,17 @@ if (count($categories) > 0) foreach ($categories as $category) { + $category['name'] = trigger_event( + 'render_category_name', + $category['name'], + 'thumbnail_category_name' + ); + $template->assign_block_vars( 'thumbnails.line.thumbnail', array( 'IMAGE' => $thumbnail_src_of[ $category['representative_picture_id'] ], - 'IMAGE_ALT' => $category['name'], + 'IMAGE_ALT' => strip_tags($category['name']), 'IMAGE_TITLE' => get_display_images_count ( $category['nb_images'], diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php index c598c30f5..cf9415400 100644 --- a/include/functions_category.inc.php +++ b/include/functions_category.inc.php @@ -296,7 +296,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' + ) + ); } $template->assign_block_vars( diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php index d8bdb833c..104f8a6ef 100644 --- a/include/functions_html.inc.php +++ b/include/functions_html.inc.php @@ -247,6 +247,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; @@ -321,6 +328,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; @@ -433,7 +446,13 @@ function get_html_menu_category($categories, $selected_category) { $menu.= ' rel="up"'; } - $menu.= ' title="'.$title.'">'.$category['name'].'</a>'; + $menu.= ' title="'.$title.'">'; + $menu.= trigger_event( + 'render_category_name', + $category['name'], + 'get_html_menu_category' + ); + $menu.= '</a>'; if ( $category['count_images']>0 ) {// at least one direct or indirect image |