[SPIP] ~2.1.12 -->2.1.25
[velocampus/web/www.git] / www / ecrire / inc / chercher_logo.php
1 <?php
2
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
5 * *
6 * Copyright (c) 2001-2014 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
8 * *
9 * Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
10 * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
11 \***************************************************************************/
12
13 if (!defined('_ECRIRE_INC_VERSION')) return;
14
15 // http://doc.spip.org/@inc_chercher_logo_dist
16 function inc_chercher_logo_dist($id, $_id_objet, $mode='on') {
17 global $formats_logos;
18 # attention au cas $id = '0' pour LOGO_SITE_SPIP : utiliser intval()
19
20 $type = type_du_logo($_id_objet);
21 $nom = $type . $mode . intval($id);
22
23 foreach ($formats_logos as $format) {
24 if (@file_exists($d = (_DIR_LOGOS . $nom . '.' . $format))) {
25 return array($d, _DIR_LOGOS, $nom, $format, @filemtime($d));
26 }
27 }
28 # coherence de type pour servir comme filtre (formulaire_login)
29 return array();
30 }
31
32 // http://doc.spip.org/@type_du_logo
33 function type_du_logo($_id_objet) {
34 return isset($GLOBALS['table_logos'][$_id_objet])
35 ? $GLOBALS['table_logos'][$_id_objet]
36 : preg_replace(',^id_,', '', $_id_objet);
37 }
38
39 // Exceptions standards (historique)
40 global $table_logos;
41 $table_logos = array(
42 'id_article' => 'art',
43 'id_auteur' => 'aut',
44 # 'id_breve' => 'breve',
45 # 'id_mot' => 'mot',
46 'id_syndic'=> 'site',
47 'id_rubrique' => 'rub'
48 );
49
50 ?>