source: extensions/skeleton/trunk/include/public_events.inc.php @ 26137

Last change on this file since 26137 was 26137, checked in by mistic100, 10 years ago
File size: 1.9 KB
Line 
1<?php
2defined('SKELETON_PATH') or die('Hacking attempt!');
3
4/**
5 * detect current section
6 */
7function skeleton_loc_end_section_init()
8{
9  global $tokens, $page, $conf;
10
11  if ($tokens[0] == 'skeleton')
12  {
13    $page['section'] = 'skeleton';
14   
15    // section_title is for breadcrumb, title is for page <title>
16    $page['section_title'] = '<a href="'.get_absolute_root_url().'">'.l10n('Home').'</a>'.$conf['level_separator'].'<a href="'.SKELETON_PUBLIC.'">'.l10n('Skeleton').'</a>';
17    $page['title'] = l10n('Skeleton');
18   
19    $page['body_id'] = 'theSkeletonPage';
20    $page['is_external'] = true; // inform Piwigo that you are on a new page
21  }
22}
23
24/**
25 * include public page
26 */
27function skeleton_loc_end_page()
28{
29  global $page, $template;
30
31  if ( isset($page['section']) and $page['section']=='skeleton' )
32  {
33    include(SKELETON_PATH . 'include/skeleton_page.inc.php');
34  }
35}
36
37/*
38 * button on album and photos pages
39 */
40function skeleton_add_button()
41{
42  global $template;
43 
44  $template->assign('SKELETON_PATH', SKELETON_PATH);
45  $template->set_filename('skeleton_button', realpath(SKELETON_PATH.'template/my_button.tpl'));
46  $button = $template->parse('skeleton_button', true);
47 
48  if (script_basename()=='index')
49  {
50    $template->add_index_button($button, EVENT_HANDLER_PRIORITY_NEUTRAL);
51  }
52  else
53  {
54    $template->add_picture_button($button, EVENT_HANDLER_PRIORITY_NEUTRAL);
55  }
56}
57
58/**
59 * add a prefilter on photo page
60 */
61function skeleton_loc_end_picture()
62{
63  global $template;
64 
65  $template->set_prefilter('picture', 'skeleton_picture_prefilter');
66}
67
68function skeleton_picture_prefilter($content)
69{
70  $search = '{if $display_info.author and isset($INFO_AUTHOR)}';
71  $replace = '<div id="Skeleton" class="imageInfo">
72                <dt>{\'Skeleton\'|@translate}</dt>
73                <dd style="color:orange;">{\'Piwigo rocks\'|@translate}</dd>
74        </div>
75'.$search;
76
77  return str_replace($search, $replace, $content);
78}
Note: See TracBrowser for help on using the repository browser.