You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.2 KiB

  1. <?php
  2. /**
  3. * Balises SPIP génériques supplémentaires, du genre Bonux
  4. *
  5. * @copyright 2015-2016
  6. * @author JLuc chez no-log.org
  7. * @licence GPL
  8. */
  9. function balise_SWITCH_dist($p) {
  10. $_val = interprete_argument_balise(1, $p);
  11. if ($_val === NULL) {
  12. $err = array('zbug_balise_sans_argument', array('balise' => ' #SWITCH'));
  13. erreur_squelette($err, $p);
  14. }
  15. else
  16. $p->code = $p->code = "(vide(\$Pile['vars']['_switch_'] = $_val).vide(\$Pile['vars']['_switch_matched_']=''))";
  17. // #GET{_switch_} renvoie maintenant la valeur testée
  18. // et #GET{_switch_matched_} indique si un test #CASE a déjà été satisfait
  19. $p->interdire_script = false;
  20. return $p;
  21. }
  22. function balise_CASE_dist($p) {
  23. $tested = interprete_argument_balise(1, $p);
  24. if ($tested === NULL) {
  25. $err = array('zbug_balise_sans_argument', array('balise' => ' #CASE'));
  26. erreur_squelette($err, $p);
  27. }
  28. else {
  29. $p->code = "(($tested == \$Pile['vars']['_switch_']) ? ' '.vide(\$Pile['vars']['_switch_matched_']=' ') : '')";
  30. };
  31. $p->interdire_script = false;
  32. return $p;
  33. }
  34. function balise_CASE_DEFAULT_dist($p) {
  35. $p->code = "(\$Pile['vars']['_switch_matched_'] ? '' : ' ')";
  36. $p->interdire_script = false;
  37. return $p;
  38. }