3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2019 *
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')) {
17 include_spip('inc/boutons');
18 include_spip('base/objets');
20 function inc_icone_renommer_dist($fond, $fonction) {
22 if (preg_match("/(?:-([0-9]{1,3}))?([.](gif|png))?$/i", $fond, $match)
23 and ((isset($match[0]) and $match[0]) or (isset($match[1]) and $match[1]))
25 if (isset($match[1]) and $match[1]) {
28 $type = substr($fond, 0, -strlen($match[0]));
29 if (!isset($match[2]) or !$match[2]) {
38 if (preg_match(',[-_]rtl$,i', $type, $match)) {
40 $type = substr($type, 0, -strlen($match[0]));
43 // objet_type garde invariant tout ce qui ne commence par par id_, spip_
44 // et ne finit pas par un s, sauf si c'est une exception declaree
45 $type = objet_type($type, false);
48 $f = "$type-$size.png";
49 if ($icone = find_in_theme($dir . $f)) {
50 $dir = dirname($icone);
54 and $fr = "$type-rtl-$size.png"
55 and file_exists($dir . '/' . $fr)
61 if ($action == "supprimer.gif") {
63 } elseif ($action == "creer.gif") {
65 } elseif ($action == "edit.gif") {
68 if (!in_array($action, array('del', 'new', 'edit'))) {
72 if ($fa = "$type-$action-$size.png"
73 and file_exists($dir . '/' . $fa)
75 $fond = $dir . '/' . $fa;
78 $fonction = "$action-$size.png";
83 return array($fond, $fonction);
86 return array($fond, $fonction);