source: extensions/Flash_Gallery/include/functions.inc.php @ 6769

Last change on this file since 6769 was 3531, checked in by tiico, 15 years ago

First revision (for testing)
Only in French (translation to be done)

File size: 3.3 KB
Line 
1<?php
2
3add_event_handler('render_flashgal_name', 'get_user_language_desc');
4
5if (!function_exists('get_user_language_desc'))
6{
7  function get_user_language_desc($desc)
8  {
9        global $user;
10   
11        $user_lang = substr($user['language'], 0, 2);
12
13        if (!substr_count(strtolower($desc), '[lang=' . $user_lang . ']'))
14        {
15                $user_lang = 'default';
16    }
17   
18    if (substr_count(strtolower($desc), '[lang=' . $user_lang . ']'))
19        {
20      // la balise avec la langue de l'utilisateur a été trouvée
21      $patterns[] = '#(^|\[/lang\])(.*?)(\[lang=(' . $user_lang . '|all)\]|$)#is';
22      $replacements[] = '';
23      $patterns[] = '#\[lang=(' . $user_lang . '|all)\](.*?)\[/lang\]#is';
24      $replacements[] = '\\1';
25    }
26    else
27    {
28      // la balise avec la langue de l'utilisateur n'a pas été trouvée
29      // On prend tout ce qui est hors balise
30      $patterns[] = '#\[lang=all\](.*?)\[/lang\]#is';
31      $replacements[] = '\\1';
32      $patterns[] = '#\[lang=.*\].*\[/lang\]#is';
33      $replacements[] = '';
34    }
35    return preg_replace($patterns, $replacements, $desc);
36  }
37}
38/*
39function pwgs_picture_special_sections()
40{
41  global $page, $conf;
42
43  if (preg_match('#&(pwgs_..)=#', $_SERVER['REQUEST_URI'], $matches))
44  {
45    if (isset($_GET['action']))
46    {
47      if (isset($page['category']))
48      {
49        $page['section'] = 'category/'.$page['category']['id'];
50        unset($page['category']);
51      }
52      $page['section'] .= $matches[0] . $_GET[$matches[1]];
53    }
54    else
55    {
56      unset($page['flat']);
57      $page['PWG_Stuffs_section'] = $matches[1];
58      $page['items'] = explode(',', $_GET[$matches[1]]);
59      $page['rank_of'] = array_flip($page['items']);
60      switch ($matches[1])
61      {
62        case 'pwgs_mv': $title = l10n('most_visited_cat'); break;
63        case 'pwgs_br': $title = l10n('best_rated_cat');   break;
64        case 'pwgs_re': $title = l10n('recent_pics_cat');  break;
65        case 'pwgs_ra': $title = l10n('random_cat');       break;
66      }
67      $page['title'] .= $conf['level_separator'] . $title;
68      add_event_handler('loc_end_page_header', 'add_pwgs_url_params');
69    }
70  }
71}
72
73function add_pwgs_url_params()
74{
75  global $page, $template;
76
77  $param = $page['PWG_Stuffs_section'];
78
79  $urls = array(
80    'first.U_IMG',
81    'previous.U_IMG',
82    'next.U_IMG',
83    'last.U_IMG',
84    'slideshow.U_START_PLAY',
85    'slideshow.U_STOP_PLAY',
86    'slideshow.U_START_REPEAT',
87    'slideshow.U_STOP_REPEAT',
88    'slideshow.U_DEC_PERIOD',
89    'slideshow.U_INC_PERIOD',
90    'U_SLIDESHOW_START',
91    'U_SLIDESHOW_STOP',
92    'U_METADATA',
93    'favorite.U_FAVORITE',
94    'U_SET_AS_REPRESENTATIVE',
95    'U_CADDIE',
96    'rating.F_ACTION',
97    'comment_add.F_ACTION',
98    'page_refresh.U_REFRESH',
99  );
100
101  foreach ($urls as $url)
102  {
103    $k = explode('.', $url);
104    if (isset($k[1]) and isset($template->smarty->_tpl_vars[$k[0]][$k[1]]))
105    {
106      $template->smarty->_tpl_vars[$k[0]][$k[1]] = add_url_params($template->smarty->_tpl_vars[$k[0]][$k[1]], array($param => $_GET[$param]));
107    }
108    elseif (!isset($k[1]) and isset($template->smarty->_tpl_vars[$k[0]]))
109    {
110      $template->smarty->_tpl_vars[$k[0]] = add_url_params($template->smarty->_tpl_vars[$k[0]], array($param => $_GET[$param]));
111    }
112  }
113}
114*/
115?>
Note: See TracBrowser for help on using the repository browser.