3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2014 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
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 \***************************************************************************/
13 if (!defined('_ECRIRE_INC_VERSION')) return;
15 include_spip('inc/boutons');
16 include_spip('base/objets');
18 function inc_icone_renommer_dist($fond,$fonction){
20 if (preg_match("/(?:-([0-9]{1,3}))?([.](gif|png))?$/i",$fond,$match)
21 AND ((isset($match[0]) AND $match[0]) OR (isset($match[1]) AND $match[1]))) {
22 if (isset($match[1]) AND $match[1]) {
25 $type = substr($fond,0,-strlen($match[0]));
26 if (!isset($match[2]) OR !$match[2]) {
36 if (preg_match(',[-_]rtl$,i',$type,$match)){
38 $type = substr($type,0,-strlen($match[0]));
41 // objet_type garde invariant tout ce qui ne commence par par id_, spip_
42 // et ne finit pas par un s, sauf si c'est une exception declaree
43 $type = objet_type($type, false);
46 $f = "$type-$size.png";
47 if ($icone = find_in_theme($dir.$f)){
48 $dir = dirname($icone);
52 AND $fr = "$type-rtl-$size.png"
53 AND file_exists($dir.'/'.$fr))
57 if ($action=="supprimer.gif"){
60 elseif ($action=="creer.gif"){
63 elseif ($action=="edit.gif"){
66 if (!in_array($action,array('del','new','edit')))
69 if ($fa = "$type-$action-$size.png"
70 AND file_exists($dir.'/'.$fa)){
71 $fond = $dir .'/'. $fa;
75 $fonction = "$action-$size.png";
79 return array($fond,$fonction);
82 return array($fond,$fonction);