X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=www%2Fplugins%2Fspip-bonux-3%2Fpublic%2Fspip_bonux_balises.php;fp=www%2Fplugins%2Fspip-bonux-3%2Fpublic%2Fspip_bonux_balises.php;h=4c2ab18817be2562a202f730ea6799854b120d0a;hb=c0f18416f529232b5555c6410a8765a5125ebcd3;hp=59bce208888d55ddfd1f8a32a21d3742d54bca80;hpb=50522c53acc9e61a4a7de3a1890c4ba93e2f61b4;p=lhc%2Fweb%2Fwww.git diff --git a/www/plugins/spip-bonux-3/public/spip_bonux_balises.php b/www/plugins/spip-bonux-3/public/spip_bonux_balises.php index 59bce208..4c2ab188 100644 --- a/www/plugins/spip-bonux-3/public/spip_bonux_balises.php +++ b/www/plugins/spip-bonux-3/public/spip_bonux_balises.php @@ -2,12 +2,14 @@ /** * Plugin Spip-Bonux * Le plugin qui lave plus SPIP que SPIP - * (c) 2008 Mathieu Marcillaud, Cedric Morin, Romy Tetue + * (c) 2008 Mathieu Marcillaud, Cedric Morin, Tetue * Licence GPL * */ -if (!defined('_ECRIRE_INC_VERSION')) return; +if (!defined('_ECRIRE_INC_VERSION')) { + return; +} /** * Empile un element dans un tableau declare par #SET{tableau,#ARRAY} @@ -17,18 +19,19 @@ if (!defined('_ECRIRE_INC_VERSION')) return; * @return Champ * La balise ne retourne rien ("") **/ -function balise_SET_PUSH_dist($p){ - $_nom = interprete_argument_balise(1,$p); - $_valeur = interprete_argument_balise(2,$p); +function balise_SET_PUSH_dist($p) { + $_nom = interprete_argument_balise(1, $p); + $_valeur = interprete_argument_balise(2, $p); - if ($_nom AND $_valeur) + if ($_nom and $_valeur) { // si le tableau n'existe pas encore, on le cree // on ajoute la valeur ensuite (sans passer par array_push) $p->code = "vide((\$cle=$_nom) . vide((!isset(\$Pile['vars'][\$cle]) OR !is_array(\$Pile['vars'][\$cle]))?\$Pile['vars'][\$cle]=array():'') . vide(\$Pile['vars'][\$cle][]=$_valeur))"; - else + } else { $p->code = "''"; + } $p->interdire_scripts = false; // la balise ne renvoie rien return $p; @@ -47,19 +50,19 @@ function balise_SET_PUSH_dist($p){ * @return Champ * La balise ne retourne rien ("") **/ -function balise_SET_MERGE_dist($p){ - $_nom = interprete_argument_balise(1,$p); - $_t1 = interprete_argument_balise(2,$p); - $_t2 = interprete_argument_balise(3,$p); +function balise_SET_MERGE_dist($p) { + $_nom = interprete_argument_balise(1, $p); + $_t1 = interprete_argument_balise(2, $p); + $_t2 = interprete_argument_balise(3, $p); - if ($_nom AND $_t1 AND !$_t2) + if ($_nom and $_t1 and !$_t2) { // 2 arguments : merge de $_nom et $_t1 dans $_nom // si le tableau n'existe pas encore, on le cree $p->code = "vide((\$cle=$_nom) . vide((!isset(\$Pile['vars'][\$cle]) OR !is_array(\$Pile['vars'][\$cle]))?\$Pile['vars'][\$cle]=array():'') . vide(is_array(\$new=$_t1)?'':\$new=array(\$new)) . vide(\$Pile['vars'][\$cle] = array_merge(\$Pile['vars'][\$cle],\$new)))"; - elseif ($_nom AND $_t1 AND $_t2) + } elseif ($_nom and $_t1 and $_t2) { // 3 arguments : merge de $_t1 et $_t2 dans $_nom // si le tableau n'existe pas encore, on le cree $p->code = "vide((\$cle=$_nom) @@ -67,8 +70,9 @@ function balise_SET_MERGE_dist($p){ . vide(is_array(\$new1=$_t1)?'':\$new1=array(\$new1)) . vide(is_array(\$new2=$_t2)?'':\$new2=array(\$new2)) . vide(\$Pile['vars'][\$cle] = array_merge(\$new1,\$new2)))"; - else + } else { $p->code = "''"; + } $p->interdire_scripts = false; // la balise ne renvoie rien return $p; @@ -82,8 +86,9 @@ function balise_SET_MERGE_dist($p){ */ function balise_COMPTEUR_dist($p) { calculer_balise_criteres('compteur', $p); - if ($p->code=="''") - calculer_balise_criteres('compteur', $p, "compteur_left"); + if ($p->code == "''") { + calculer_balise_criteres('compteur', $p, 'compteur_left'); + } return $p; } @@ -117,20 +122,18 @@ function balise_MAXIMUM_dist($p) { */ function balise_STATS_dist($p) { if (isset($p->param[0][2][0]) - AND $nom = ($p->param[0][2][0]->texte)) { + and $nom = ($p->param[0][2][0]->texte)) { return calculer_balise_criteres($nom, $p, 'stats'); } return $p; } -function calculer_balise_criteres($nom, $p, $motif="") { +function calculer_balise_criteres($nom, $p, $motif = '') { $p->code = "''"; $motif = $motif ? $motif : $nom; if (isset($p->param[0][1][0]) - AND $champ = ($p->param[0][1][0]->texte)) { + and $champ = ($p->param[0][1][0]->texte)) { return rindex_pile($p, $nom."_$champ", $motif); } - return $p; + return $p; } - -?>