Browse Source

dans le bon dossier

master
brunobergot@gmail.com 7 years ago
commit
1af79523c8
  1. 6
      .gitattributes
  2. 0
      doc.txt
  3. BIN
      images/switch case by Piotr Kołodziejski 700x700.png
  4. BIN
      images/switchcase-32.png
  5. 18
      paquet.xml
  6. 40
      switchcase_options.php

6
.gitattributes vendored

@ -0,0 +1,6 @@
* text=auto !eol
/doc.txt -text
images/switch[!!-~]case[!!-~]by[!!-~]Piotr[!!-~]Kołodziejski[!!-~]700x700.png -text
images/switchcase-32.png -text
/paquet.xml -text
/switchcase_options.php -text

BIN
images/switch case by Piotr Kołodziejski 700x700.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
images/switchcase-32.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

18
paquet.xml

@ -0,0 +1,18 @@
<paquet
prefix="switchcase"
categorie="outil"
version="0.1.0"
etat="dev"
compatibilite="[3.0.0;3.1.*]"
logo="images/switchcase-32.png"
>
<nom>Balises #SWITCH #CASE</nom>
<!-- Lecteur de tables SQL -->
<auteur lien="http://contrib.spip.net/JLuc">JLuc</auteur>
<licence lien="http://www.gnu.org/licenses/gpl-3.0.html">GNU/GPL</licence>
<credit lien="https://thenounproject.com/term/flow-chart/49063/">Inspiration pour l'icone : flowchart by Piotr Kołodziejski, Licence Creative Commons</credit>
</paquet>

40
switchcase_options.php

@ -0,0 +1,40 @@
<?php
/**
* Balises SPIP génériques supplémentaires, du genre Bonux
*
* @copyright 2015
* @author JLuc chez no-log.org
* @licence GPL
*/
function balise_SWITCH_dist($p) {
$_val = interprete_argument_balise(1, $p);
if ($_val === NULL)
$p->code="'il faut 1 argument pour la balise #SWITCH et très exactement 1 pour l\'instant'";
else
$p->code = $p->code = "vide(\$Pile['vars'][\$_zzz=(string)'_switch_'] = $_val)";
// #GET{_switch_} vaut maintenant la valeur testée
$p->interdire_script = false;
return $p;
}
function balise_CASE_dist($p) {
$tested = interprete_argument_balise(1, $p);
if ($tested === NULL)
$p->code="'il faut 1 ou 2 arguments pour la balise #CASE (1 seulement si on a fait # SWITCH(XXX) avant : todo)'";
else {
$value = interprete_argument_balise(2, $p);
if ($value === NULL) {
$value=$tested;
$tested = "(\$Pile['vars'][\$_zzz=(string)'_switch_'])";
}
$p->code = "(($tested == $value) ? ' ' : '')";
};
$p->interdire_script = false;
return $p;
}
Loading…
Cancel
Save