[SPIP][PLUGINS] v3.0-->v3.2
[lhc/web/www.git] / www / plugins-dist / textwheel / wheels / spip / spip.php
index 3857d63..410dc25 100644 (file)
@@ -1,29 +1,64 @@
 <?php
 
-if (!defined('_ECRIRE_INC_VERSION')) return;
+/**
+ * Fonctions utiles pour les wheels SPIP
+ *
+ * @SPIP\Textwheel\Wheel\SPIP\Fonctions
+ **/
+
+if (!defined('_ECRIRE_INC_VERSION')) {
+       return;
+}
 
 include_spip('inc/texte');
 
 /**
- * callback pour la puce qui est definissable/surchargeable
+ * Callback pour les <math></math>
+ * Gestion du TeX
+ *
+ * @param string $t
  * @return string
  */
-function replace_puce(){
+function replace_math($t) {
+       if (!function_exists('traiter_math')) {
+               include_spip('inc/math');
+       }
+
+       $t = traiter_math($t, '', true);
+
+       return $t;
+}
+
+/**
+ * Callback pour la puce qui est définissable/surchargeable
+ *
+ * @return string
+ *     Code HTML d'une puce
+ */
+function replace_puce() {
        static $puce;
-       if (!isset($puce))
-               $puce = "\n<br />".definir_puce()."&nbsp;";
+       if (!isset($puce)) {
+               $puce = "\n<br />" . definir_puce() . "&nbsp;";
+       }
+
        return $puce;
 }
 
 /**
- * callback pour les Abbr :
- * [ABBR|abbrevation]
- * [ABBR|abbrevation{lang}]
+ * Callback pour les Abbr
+ *
+ * @example
+ *     ```
+ *     [ABBR|abbrevation]
+ *     [ABBR|abbrevation{lang}]
+ *     ```
  * @param array $m
  * @return string
+ *     Code HTML d'une abréviation
  */
-function inserer_abbr($m){
+function inserer_abbr($m) {
        $title = attribut_html($m[2]);
-       $lang = (isset($m[3])?" lang=\"".$m[3]."\"":"");
-       return "<abbr title=\"$title\"$lang>".$m[1]."</abbr>";
-}
\ No newline at end of file
+       $lang = (isset($m[3]) ? " lang=\"" . $m[3] . "\"" : "");
+
+       return "<abbr title=\"$title\"$lang>" . $m[1] . "</abbr>";
+}