forked from spip-contrib-extensions/switchcase

commit
1af79523c8
6 changed files with 64 additions and 0 deletions
@ -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 |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 1.2 KiB |
@ -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> |
@ -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…
Reference in new issue