[SPIP] +2.1.12
[velocampus/web/www.git] / www / plugins / auto / couteau_suisse / couteau_suisse / outils / horloge_fonctions.php
1 <?php
2 // action speciale, si cs_dateserveur=oui
3 if(!isset($GLOBALS['cs_fonctions']) && isset($_GET['cs_dateserveur'])) {
4 header('Content-Type: text/xml');
5 echo '<?xml version="1.0" encoding="UTF-8"?>',
6 '<curTime><U>', date("U"), '</U><Z>', date("Z"), '</Z></curTime>';
7 exit;
8 }
9
10 // La balise #HORLOGE
11 function balise_HORLOGE_dist($p) {
12 $i = 1; $args = array();
13 while(($a = interprete_argument_balise($i++,$p)) != NULL) $args[] = $a;
14 $args = count($args)?join(".'||'.", $args):"''";
15 $p->code = "horloge_params($args)";
16 $p->interdire_scripts = false;
17 return $p;
18 }
19
20 function horloge_params($args) {
21 $t = array();
22 $bal = 'span'; $def='99:99';
23 $args = explode('||', $args);
24 foreach($args as $a) {
25 list($a, $b) = explode('=', $a, 2);
26 if($b=="''" || $b=='""') $b = '';
27 if(strlen($a)) {
28 if($a=='id') $id = 'jclock'.$b;
29 elseif($a=='defaut') $def = $b;
30 elseif($a=='balise') $bal = $b;
31 else $t[$a] = "$a=$b";
32 }
33 }
34 return "<$bal class=\"jclock" . (isset($id)?" $id\" id=\"$id":'')
35 .'" title="'.join('||',$t)."\">$def</$bal> ";
36 }
37 ?>