X-Git-Url: https://git.cyclocoop.org/%28%28?a=blobdiff_plain;f=www%2Fplugins%2Fauto%2Fcouteau_suisse%2Fcouteau_suisse%2Foutils%2Fsmileys_fonctions.php;fp=www%2Fplugins%2Fauto%2Fcouteau_suisse%2Fcouteau_suisse%2Foutils%2Fsmileys_fonctions.php;h=900ac6a2e9465c79ce4eea0a063f4b6a8e694e4b;hb=80b4d3e85f78d402ed2e73f8f5d1bf4c19962eed;hp=0000000000000000000000000000000000000000;hpb=aaf970bf4cdaf76689ecc10609048e18d073820c;p=velocampus%2Fweb%2Fwww.git diff --git a/www/plugins/auto/couteau_suisse/couteau_suisse/outils/smileys_fonctions.php b/www/plugins/auto/couteau_suisse/couteau_suisse/outils/smileys_fonctions.php new file mode 100644 index 0000000..900ac6a --- /dev/null +++ b/www/plugins/auto/couteau_suisse/couteau_suisse/outils/smileys_fonctions.php @@ -0,0 +1,104 @@ +/* 0 && (txtarea.value).substring(selEnd-1,selEnd) == ' ') selEnd = selEnd-1; + var s1 = (txtarea.value).substring(0,selStart); + var s2 = (txtarea.value).substring(selStart, selEnd) + var s3 = (txtarea.value).substring(selEnd, selLength); + txtarea.value = s1 + open + s2 + close + s3; + selDeb = selStart + open.length; + selFin = selEnd + close.length; + window.setSelectionRange(txtarea, selDeb, selFin); + txtarea.scrollTop = selTop; + txtarea.focus(); + return; +}} +/*]]>*/\n"; + // le tableau des smileys est present dans les metas + $smileys = cs_lire_data_outil('smileys');; + // valeurs par defaut + $nb_col = 8; + $titre = _T('couteau:smileys_dispos'); + $head = ''; + $liens = false; + // traitement des arguments : [(#SMILEYS{arg1, arg2, ...})] + $n=1; + $arg = interprete_argument_balise($n++,$p); + while ($arg){ + // un nombre est le nombre de colonne + if (preg_match(",'([0-9]+)',", $arg, $reg)) + $nb_col = intval($reg[1]); + // on veut un titre + elseif ($arg=="'titre'") + $head = "$titre"; + // on veut un lien d'insertion sur chaque smiley + elseif ($arg=="'liens'") { + $liens = true; + include_spip('outils/smileys'); + $smileys = smileys_uniques($smileys); + } + $arg = interprete_argument_balise($n++,$p); + } + $max = count($smileys[0]); + if (!$nb_col) $nb_col = $max; + $html = "$head"; + $l = 1; + for ($i=0; $i<$max; $i++) { + if ($i % $nb_col == 0) { + $class = 'row_'.alterner($l++, 'even', 'odd'); + $html .= ""; + } + $html .= $liens + ?"" + :""; + if ($i % $nb_col == $nb_col - 1) + $html .= "\n"; + } + // on finit la ligne qd meme... + if ($i = $max % $nb_col) $html .= str_repeat('', $nb_col - $i) . ''; + + // accessibilite : alt et title avec le smiley en texte + $html = $js_compat . echappe_retour($html, 'SMILE'); + $html = str_replace("'", "\'", $html); + $p->code = "'$html\n
{$smileys[1][$i]}{$smileys[1][$i]}
{$smileys[0][$i]}
 
\n'"; + $p->interdire_scripts = false; + $p->type = 'html'; + return $p; +} + +?> \ No newline at end of file