Skip to content
Extraits de code Groupes Projets
Valider d49d33f4 rédigé par RastaPopoulos's avatar RastaPopoulos
Parcourir les fichiers

Nouveau pipeline "chercher_logo", qui permet de compléter ou ajouter des infos...

Nouveau pipeline "chercher_logo", qui permet de compléter ou ajouter des infos de logos après que SPIP ait cherché avec sa méthode classique. On peut donc fournir autre chose, et surtout on peut définir un logo si SPIP n'en a pas trouvé avant (exemple : prendre la première image jointe trouvée, comme dans Logo auto de Tetue). Sans avoir à surcharger salement ni bloquer d'autres méthodes ensuite.
parent 7c19491a
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -37,18 +37,35 @@ if (!defined('_ECRIRE_INC_VERSION')) { ...@@ -37,18 +37,35 @@ if (!defined('_ECRIRE_INC_VERSION')) {
**/ **/
function inc_chercher_logo_dist($id, $_id_objet, $mode = 'on') { function inc_chercher_logo_dist($id, $_id_objet, $mode = 'on') {
# attention au cas $id = '0' pour LOGO_SITE_SPIP : utiliser intval() # attention au cas $id = '0' pour LOGO_SITE_SPIP : utiliser intval()
$infos_logo = array();
$type = type_du_logo($_id_objet); $type = type_du_logo($_id_objet);
$nom = $type . $mode . intval($id); $nom = $type . $mode . intval($id);
foreach ($GLOBALS['formats_logos'] as $format) { foreach ($GLOBALS['formats_logos'] as $format) {
if (@file_exists($d = (_DIR_LOGOS . $nom . '.' . $format))) { if (@file_exists($d = (_DIR_LOGOS . $nom . '.' . $format))) {
return array($d, _DIR_LOGOS, $nom, $format, @filemtime($d)); $infos_logo = array($d, _DIR_LOGOS, $nom, $format, @filemtime($d));
break; // On sort au premier logo trouvé
} }
} }
// On passe dans un pipeline
$infos_logo = pipeline(
'chercher_logo',
array(
'args' => array(
'id_objet' => $id,
'objet' => objet_type($_id_objet),
'cle_objet' => $_id_objet,
'type' => $type,
'mode' => $mode,
),
'data' => $infos_logo,
)
);
# coherence de type pour servir comme filtre (formulaire_login) # coherence de type pour servir comme filtre (formulaire_login)
return array(); return $infos_logo;
} }
/** /**
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
<pipeline nom="ajouter_onglets" action="" /> <pipeline nom="ajouter_onglets" action="" />
<pipeline nom="body_prive" action="" /> <pipeline nom="body_prive" action="" />
<pipeline nom="calculer_rubriques" action="" /> <pipeline nom="calculer_rubriques" action="" />
<pipeline nom="chercher_logo" action="" />
<pipeline nom="configurer_liste_metas" action="" /> <pipeline nom="configurer_liste_metas" action="" />
<pipeline nom="compter_contributions_auteur" action="" /> <pipeline nom="compter_contributions_auteur" action="" />
<pipeline nom="declarer_filtres_squelettes" action="" /> <pipeline nom="declarer_filtres_squelettes" action="" />
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter