Browse Source

PSR SPIP

svn/root/tags/v3.5.15
kent1@arscenic.info 7 years ago
parent
commit
69282ff021
  1. 40
      base/typoenluminee_upgrade.php
  2. 495
      enluminures_typo_pipelines.php
  3. 18
      exec/tableau_edit.php
  4. 5
      lang/paquet-typoenluminee_fr.php
  5. 624
      typoenluminee.php
  6. 33
      typoenluminee_administrations.php
  7. 32
      typoenluminee_options.php
  8. 63
      typoenluminee_pipelines.php

40
base/typoenluminee_upgrade.php

@ -1,6 +1,8 @@
<?php
if (!defined("_ECRIRE_INC_VERSION")) return;
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
include_spip('inc/meta');
@ -10,39 +12,39 @@ include_spip('inc/meta');
* @param string $nom_meta_base_version
* @param string $version_cible
*/
function typoenluminee_upgrade($nom_meta_base_version,$version_cible){
function typoenluminee_upgrade($nom_meta_base_version, $version_cible) {
$current_version = '0.0';
if ( (!isset($GLOBALS['meta'][$nom_meta_base_version]) )
|| (($current_version = $GLOBALS['meta'][$nom_meta_base_version])!=$version_cible)){
if ((!isset($GLOBALS['meta'][$nom_meta_base_version]))
|| (($current_version = $GLOBALS['meta'][$nom_meta_base_version])!=$version_cible)) {
// installation
if (version_compare($current_version, '0.0','<=')){
if (version_compare($current_version, '0.0', '<=')) {
maj_titres_enlumines();
ecrire_meta($nom_meta_base_version,$current_version=$version_cible,'non');
ecrire_meta($nom_meta_base_version, $current_version = $version_cible, 'non');
}
}
}
/**
* Abandon de l'ancienne écriture des intertitres
*
*
* {1{...}1} {2{...}2} {3{...}3} {4{...}4} {5{...}5} en intertitres avec étoiles :
* {{{...}}} {{{**...}}} {{{***...}}} {{{****...}}} {{{*****...}}}
*
*
*/
function maj_titres_enlumines(){
$anciens_titres = sql_allfetsel('id_article,texte','spip_articles','texte LIKE "%{1{%" OR texte LIKE "%{2{%" OR texte LIKE "%{3{%" OR texte LIKE "%{4{%" OR texte LIKE "%{5{%"');
foreach($anciens_titres as $cle => $article){
function maj_titres_enlumines() {
$anciens_titres = sql_allfetsel('id_article,texte', 'spip_articles', 'texte LIKE "%{1{%" OR texte LIKE "%{2{%" OR texte LIKE "%{3{%" OR texte LIKE "%{4{%" OR texte LIKE "%{5{%"');
foreach ($anciens_titres as $cle => $article) {
$id_article = $article['id_article'];
$article['texte'] = preg_replace('/({1{)(.*)(}1})/Uims','{{{\\2}}}',$article['texte']);
$article['texte'] = preg_replace('/({2{)(.*)(}2})/Uims','{{{**\\2}}}',$article['texte']);
$article['texte'] = preg_replace('/({3{)(.*)(}3})/Uims','{{{***\\2}}}',$article['texte']);
$article['texte'] = preg_replace('/({4{)(.*)(}4})/Uims','{{{****\\2}}}',$article['texte']);
$article['texte'] = preg_replace('/({5{)(.*)(}5})/Uims','{{{*****\\2}}}',$article['texte']);
$article['texte'] = preg_replace('/({1{)(.*)(}1})/Uims', '{{{\\2}}}', $article['texte']);
$article['texte'] = preg_replace('/({2{)(.*)(}2})/Uims', '{{{**\\2}}}', $article['texte']);
$article['texte'] = preg_replace('/({3{)(.*)(}3})/Uims', '{{{***\\2}}}', $article['texte']);
$article['texte'] = preg_replace('/({4{)(.*)(}4})/Uims', '{{{****\\2}}}', $article['texte']);
$article['texte'] = preg_replace('/({5{)(.*)(}5})/Uims', '{{{*****\\2}}}', $article['texte']);
$article['texte'] = trim($article['texte']);
sql_updateq('spip_articles',array('texte' => $article['texte']),'id_article='.intval($article['id_article']));
if (time() >= _UPGRADE_TIME_OUT)
sql_updateq('spip_articles', array('texte' => $article['texte']), 'id_article=' . intval($article['id_article']));
if (time() >= _UPGRADE_TIME_OUT) {
return;
}
}
}

495
enluminures_typo_pipelines.php

@ -1,246 +1,249 @@
<?php
if (!defined("_ECRIRE_INC_VERSION")) return;
function typoenluminee_porte_plume_barre_pre_charger($barres){
$barre = &$barres['edition'];
$barre->cacher('italic');
$barre->cacher('stroke_through');
$barre->cacher('notes');
$barre->cacher('sepCode');
$barre->cacher('grpCode');
$module_barre = "barre_outils";
if (intval($GLOBALS['spip_version_branche'])>2)
$module_barre = "barreoutils";
$barre->set('header1', array(
// groupe formatage paragraphe
"dropMenu" => array(
array(
"id" => 'intertitre',
"name" => _T('barre_intertitre'),
"className" => 'outil_intertitre1',
"openWith" => "\n{{{",
"closeWith" => "}}}\n",
"display" => true,
"selectionType" => "line",
),
array(
"id" => 'intertitre2',
"name" => _T('enlumtypo:barre_intertitre2'),
"className" => 'outil_intertitre2',
"openWith" => "\n{{{**",
"closeWith" => "}}}\n",
"display" => true,
"selectionType" => "line",
),
array(
"id" => 'intertitre3',
"name" => _T('enlumtypo:barre_intertitre3'),
"className" => 'outil_intertitre3',
"openWith" => "\n{{{***",
"closeWith" => "}}}\n",
"display" => true,
"selectionType" => "line",
),
array(
"id" => 'alignerdroite',
"name" => _T('enlumtypo:barre_alignerdroite'),
"className" => 'outil_alignerdroite',
"openWith" => "\n[/",
"closeWith" => "/]\n",
"display" => true,
"selectionType" => "line",
),
array(
"id" => 'alignergauche',
"name" => _T('enlumtypo:barre_alignergauche'),
"className" => 'outil_alignergauche',
"openWith" => "\n[!",
"closeWith" => "!]\n",
"display" => true,
"lang" => array('ar','fa'),
"selectionType" => "line",
),
array(
"id" => 'cadretexte',
"name" => _T('enlumtypo:barre_encadrer'),
"className" => 'outil_cadretexte',
"openWith" => "\n[(",
"closeWith" => ")]\n",
"display" => true,
"selectionType" => "line",
),
array(
"id" => 'barre_cadre',
"name" => _T($module_barre.':barre_cadre'),
"className" => "outil_barre_cadre",
"openWith" => "\n&lt;cadre&gt;",
"closeWith" => "&lt;/cadre&gt;\n",
"display" => true,
"selectionType" => "line",
),
),
));
$barre->set('bold', array(
// groupe formatage texte
"dropMenu" => array(
// Italic - {
array(
"id" => 'italic',
"name" => _T('barreoutils:barre_italic'),
"key" => "I",
"className" => "outil_italic",
"replaceWith" => "function(h){ return espace_si_accolade(h, '{', '}');}",
//"openWith" => "{",
//"closeWith" => "}",
"display" => true,
"selectionType" => "word",
),
// Petites capitales
array(
"id" => 'petitescapitales',
"name" => _T('enlumtypo:barre_petitescapitales'),
"className" => "outil_petitescapitales",
"openWith" => "<sc>",
"closeWith" => "</sc>",
"display" => true,
"selectionType" => "word",
),
// montrer une suppression
array(
"id" => 'stroke_through_et',
"name" => _T('enlumtypo:barre_barre'), // :-)
"className" => "outil_stroke_through_et",
"openWith" => "<del>",
"closeWith" => "</del>",
"display" => true,
"selectionType" => "word",
),
// Mise en évidence (gras + couleur)
array(
"id" => 'miseenevidence',
"name" => _T('enlumtypo:barre_miseenevidence'),
"className" => "outil_miseenevidence",
"openWith" => "[*",
"closeWith" => "*]",
"display" => true,
"selectionType" => "word",
),
// Mise en évidence2 (gras + autre couleur)
array(
"id" => 'miseenevidence2',
"name" => _T('enlumtypo:barre_miseenevidence2'),
"className" => "outil_miseenevidence2",
"openWith" => "[**",
"closeWith" => "*]",
"display" => true,
"selectionType" => "word",
),
// Mise en exposant
array(
"id" => 'exposant',
"name" => _T('enlumtypo:barre_exposant'),
"className" => "outil_exposant",
"openWith" => "<sup>",
"closeWith" => "</sup>",
"display" => true,
"selectionType" => "word",
),
// Mise en indice
array(
"id" => 'indice',
"name" => _T('enlumtypo:barre_indice'),
"className" => "outil_indice",
"openWith" => "<sub>",
"closeWith" => "</sub>",
"display" => true,
"selectionType" => "word",
),
// cadre spip
array(
"id" => 'barre_code',
"name" => _T($module_barre.':barre_code'),
"className" => "outil_barre_code",
"openWith" => "&lt;code&gt;",
"closeWith" => "&lt;/code&gt;",
"display" => true,
"selectionType" => "word",
),
),
));
$barre->set('link', array(
// groupe formatage texte
"dropMenu" => array(
array(
"id" => 'notes',
"name" => _T('barreoutils:barre_note'),
"className" => "outil_notes",
"openWith" => "[[",
"closeWith" => "]]",
"display" => true,
"selectionType" => "word",
),
),
));
// Appel Tableau
$barre->ajouterApres('notes', array(
"id" => 'barre_tableau',
"name" => _T('enlumtypo:barre_tableau'),
"className" => "outil_barre_tableau",
"replaceWith" => 'function(markitup) { zone_selection = markitup.textarea; window.open("?exec=tableau_edit", "","scrollbars=yes,resizable=yes,width=700,height=600") }',
"display" => true,
"selectionType" => "line",
));
$barre->set('quote', array(
"openWith" => "<quote>",
"closeWith" => "</quote>",
));
$barre->set('quote', array(
"dropMenu" => array(
// poesie spip
array(
"id" => 'barre_poesie',
"name" => _T($module_barre.':barre_poesie'),
"className" => "outil_barre_poesie",
"openWith" => "\n&lt;poesie&gt;\n",
"closeWith" => "\n&lt;/poesie&gt;\n",
"display" => true,
"selectionType" => "word",
),
),
));
return $barres;
}
function typoenluminee_porte_plume_lien_classe_vers_icone($flux){
return array_merge($flux, array(
'outil_intertitre1' => array('spt-v1.png','-10px -226px'), //'intertitre.png'
'outil_intertitre2' => array('intertitre2.png','0'),
'outil_intertitre3' => array('intertitre3.png','0'),
'outil_alignerdroite' => array('right.png','0'),
'outil_alignergauche' => array('left.png','0'),
'outil_stroke_through_et' => array('spt-v1.png','-10px -946px'), //'text_strikethrough.png'
'outil_cadretexte' => array('cadretexte.png','0'),
'outil_speciaux' => array('tag.png','0'),
'outil_barre_code' => array('page_white_code_red.png','0'),
'outil_barre_cadre' => array('page_white_code.png','0'),
'outil_miseenevidence' => array('miseenevidence.png','0'),
'outil_miseenevidence2' => array('miseenevidence2.png','0'),
'outil_exposant' => array('exposant.png','0'),
'outil_indice' => array('indice.png','0'),
'outil_petitescapitales' => array('petitescapitales.png','0'),
'outil_barre_poesie' => array('poesie.png','0'),
'outil_barre_tableau' => array('barre-tableau.png','0'),
));
}
?>
<?php
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
function typoenluminee_porte_plume_barre_pre_charger($barres) {
$barre = &$barres['edition'];
$barre->cacher('italic');
$barre->cacher('stroke_through');
$barre->cacher('notes');
$barre->cacher('sepCode');
$barre->cacher('grpCode');
$module_barre = 'barre_outils';
if (intval($GLOBALS['spip_version_branche']) > 2) {
$module_barre = 'barreoutils';
}
$barre->set('header1', array(
// groupe formatage paragraphe
'dropMenu' => array(
array(
'id' => 'intertitre',
'name' => _T('barre_intertitre'),
'className' => 'outil_intertitre1',
'openWith' => "\n{{{",
'closeWith' => "}}}\n",
'display' => true,
'selectionType' => 'line',
),
array(
'id' => 'intertitre2',
'name' => _T('enlumtypo:barre_intertitre2'),
'className' => 'outil_intertitre2',
'openWith' => "\n{{{**",
'closeWith' => "}}}\n",
'display' => true,
'selectionType' => 'line',
),
array(
'id' => 'intertitre3',
'name' => _T('enlumtypo:barre_intertitre3'),
'className' => 'outil_intertitre3',
'openWith' => "\n{{{***",
'closeWith' => "}}}\n",
'display' => true,
'selectionType' => 'line',
),
array(
'id' => 'alignerdroite',
'name' => _T('enlumtypo:barre_alignerdroite'),
'className' => 'outil_alignerdroite',
'openWith' => "\n[/",
'closeWith' => "/]\n",
'display' => true,
'selectionType' => 'line',
),
array(
'id' => 'alignergauche',
'name' => _T('enlumtypo:barre_alignergauche'),
'className' => 'outil_alignergauche',
'openWith' => "\n[!",
'closeWith' => "!]\n",
'display' => true,
'lang' => array('ar', 'fa'),
'selectionType' => 'line',
),
array(
'id' => 'cadretexte',
'name' => _T('enlumtypo:barre_encadrer'),
'className' => 'outil_cadretexte',
'openWith' => "\n[(",
'closeWith' => ")]\n",
'display' => true,
'selectionType' => 'line',
),
array(
'id' => 'barre_cadre',
'name' => _T($module_barre.':barre_cadre'),
'className' => 'outil_barre_cadre',
'openWith' => "\n&lt;cadre&gt;",
'closeWith' => "&lt;/cadre&gt;\n",
'display' => true,
'selectionType' => 'line',
),
),
));
$barre->set('bold', array(
// groupe formatage texte
'dropMenu' => array(
// Italic - {
array(
'id' => 'italic',
'name' => _T('barreoutils:barre_italic'),
'key' => 'I',
'className' => 'outil_italic',
'replaceWith' => "function(h){ return espace_si_accolade(h, '{', '}');}",
//'openWith' => '{',
//'closeWith' => '}',
'display' => true,
'selectionType' => 'word',
),
// Petites capitales
array(
'id' => 'petitescapitales',
'name' => _T('enlumtypo:barre_petitescapitales'),
'className' => 'outil_petitescapitales',
'openWith' => '<sc>',
'closeWith' => '</sc>',
'display' => true,
'selectionType' => 'word',
),
// montrer une suppression
array(
'id' => 'stroke_through_et',
'name' => _T('enlumtypo:barre_barre'), // :-)
'className' => 'outil_stroke_through_et',
'openWith' => '<del>',
'closeWith' => '</del>',
'display' => true,
'selectionType' => 'word',
),
// Mise en évidence (gras + couleur)
array(
'id' => 'miseenevidence',
'name' => _T('enlumtypo:barre_miseenevidence'),
'className' => 'outil_miseenevidence',
'openWith' => '[*',
'closeWith' => '*]',
'display' => true,
'selectionType' => 'word',
),
// Mise en évidence2 (gras + autre couleur)
array(
'id' => 'miseenevidence2',
'name' => _T('enlumtypo:barre_miseenevidence2'),
'className' => 'outil_miseenevidence2',
'openWith' => '[**',
'closeWith' => '*]',
'display' => true,
'selectionType' => 'word',
),
// Mise en exposant
array(
'id' => 'exposant',
'name' => _T('enlumtypo:barre_exposant'),
'className' => 'outil_exposant',
'openWith' => '<sup>',
'closeWith' => '</sup>',
'display' => true,
'selectionType' => 'word',
),
// Mise en indice
array(
'id' => 'indice',
'name' => _T('enlumtypo:barre_indice'),
'className' => 'outil_indice',
'openWith' => '<sub>',
'closeWith' => '</sub>',
'display' => true,
'selectionType' => 'word',
),
// cadre spip
array(
'id' => 'barre_code',
'name' => _T($module_barre.':barre_code'),
'className' => 'outil_barre_code',
'openWith' => '&lt;code&gt;',
'closeWith' => '&lt;/code&gt;',
'display' => true,
'selectionType' => 'word',
),
),
));
$barre->set('link', array(
// groupe formatage texte
'dropMenu' => array(
array(
'id' => 'notes',
'name' => _T('barreoutils:barre_note'),
'className' => 'outil_notes',
'openWith' => '[[',
'closeWith' => ']]',
'display' => true,
'selectionType' => 'word',
),
),
));
// Appel Tableau
$barre->ajouterApres('notes', array(
'id' => 'barre_tableau',
'name' => _T('enlumtypo:barre_tableau'),
'className' => 'outil_barre_tableau',
'replaceWith' => 'function(markitup) { zone_selection = markitup.textarea; window.open("?exec=tableau_edit", "","scrollbars=yes,resizable=yes,width=700,height=600") }',
'display' => true,
'selectionType' => 'line',
));
$barre->set('quote', array(
'openWith' => '<quote>',
'closeWith' => '</quote>',
));
$barre->set('quote', array(
'dropMenu' => array(
// poesie spip
array(
'id' => 'barre_poesie',
'name' => _T($module_barre.':barre_poesie'),
'className' => 'outil_barre_poesie',
'openWith' => "\n&lt;poesie&gt;\n",
'closeWith' => "\n&lt;/poesie&gt;\n",
'display' => true,
'selectionType' => 'word',
),
),
));
return $barres;
}
function typoenluminee_porte_plume_lien_classe_vers_icone($flux) {
return array_merge($flux, array(
'outil_intertitre1' => array('spt-v1.png','-10px -226px'), //'intertitre.png'
'outil_intertitre2' => array('intertitre2.png','0'),
'outil_intertitre3' => array('intertitre3.png','0'),
'outil_alignerdroite' => array('right.png','0'),
'outil_alignergauche' => array('left.png','0'),
'outil_stroke_through_et' => array('spt-v1.png','-10px -946px'), //'text_strikethrough.png'
'outil_cadretexte' => array('cadretexte.png','0'),
'outil_speciaux' => array('tag.png','0'),
'outil_barre_code' => array('page_white_code_red.png','0'),
'outil_barre_cadre' => array('page_white_code.png','0'),
'outil_miseenevidence' => array('miseenevidence.png','0'),
'outil_miseenevidence2' => array('miseenevidence2.png','0'),
'outil_exposant' => array('exposant.png','0'),
'outil_indice' => array('indice.png','0'),
'outil_petitescapitales' => array('petitescapitales.png','0'),
'outil_barre_poesie' => array('poesie.png','0'),
'outil_barre_tableau' => array('barre-tableau.png','0'),
));
}

18
exec/tableau_edit.php

@ -1,8 +1,10 @@
<?php
if (!defined("_ECRIRE_INC_VERSION")) return;
function exec_tableau_edit_dist() {
include_spip("public/assembler"); // Pour pouvoir utiliser recuperer_fond
echo recuperer_fond('editeur/tableau_edit');
}
?>
<?php
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
function exec_tableau_edit_dist() {
include_spip('public/assembler'); // Pour pouvoir utiliser recuperer_fond
echo recuperer_fond('editeur/tableau_edit');
}

5
lang/paquet-typoenluminee_fr.php

@ -8,7 +8,9 @@
// Date: 08-01-2012 17:02:08
// Items: 2
if (!defined('_ECRIRE_INC_VERSION')) return;
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
$GLOBALS[$GLOBALS['idx_lang']] = array(
@ -29,4 +31,3 @@ $GLOBALS[$GLOBALS['idx_lang']] = array(
',
'typoenluminee_slogan' => 'Plein de raccourcis pour la mise en forme !',
);
?>

624
typoenluminee.php

@ -1,307 +1,317 @@
<?php
if (!defined("_ECRIRE_INC_VERSION")) return;
/*
*
*/
/**
* Ce plugin rajoute des raccourcis typographique et ameliore les possibilites de la barre typographique pour les redacteurs
*
*
* Fonctions de ces filtres :
* Ils rajoutent quelques racourcis typo a SPIP
*
* Syntaxe des raccourcis :
* [/texte/] : aligner le texte a droite
* [!texte!] : aligner le texte a gauche
* [|texte|] : centrer le texte
* [(texte)] : encadrer le texte (occupe toute la largeur de la page, a mettre autour d'un paragraphe)
* [*texte*] : encadrer/surligner le texte (une partie a l'interieur d'un paragraphe)
* [**texte*] : variante encadrer/surligner le texte (une partie a l'interieur d'un paragraphe)
* <sup>texte</sup> : mettre en exposant le texte selectionne
* <sub>texte</sub> : mettre en indice le texte selectionne
*
* Styles pour les encadrements a rajouter dans votre feuille de style :
* .texteencadre-spip {
* background: #FFE;
* border-bottom: 2px solid #999999;
* border-left: 1px solid #EEEEEE;
* border-right: 2px solid #999999;
* border-top: 1px solid #EEEEEE;
* padding: .25em;
* }
* .caractencadre-spip {
* border: 1px solid #666;
* padding: 0px .5em 0px .5em;
* }
*/
// Gerer les variables de personnalisation, fonction depreciee sous SPIP 2.0
// A suivre sur la methode...
if(!function_exists('tester_variable')) {
function tester_variable($var, $val){
if (!isset($GLOBALS[$var])) $GLOBALS[$var] = $val;
}
}
function typoenluminee_pre_propre($texte) {
if(!$texte) return $texte;
static $chercher_raccourcis=NULL;
static $remplacer_raccourcis=NULL;
if ($chercher_raccourcis===NULL) {
// tous les elements block doivent etre introduits ici
// pour etre pris en charge par paragrapher
// Definition des differents intertitres possibles, si pas deja definies
if ((!function_exists('lire_config')) OR (isset($GLOBALS['config_intertitre']))) {
tester_variable('debut_intertitre', '<h3 class="spip">');
tester_variable('fin_intertitre', '</h3>');
tester_variable('debut_intertitre_2', '<h4 class="spip">');
tester_variable('fin_intertitre_2', '</h4>');
tester_variable('debut_intertitre_3', '<h5 class="spip">');
tester_variable('fin_intertitre_3', '</h5>');
tester_variable('debut_intertitre_4', '<h6 class="spip">');
tester_variable('fin_intertitre_4', '</h6>');
tester_variable('debut_intertitre_5', '<strong class="spip titraille5">');
tester_variable('fin_intertitre_5', '</strong>');
} else {
$GLOBALS['debut_intertitre'] = lire_config('bte/titraille1open','<h3 class="spip">');
$GLOBALS['fin_intertitre'] = lire_config('bte/titraille1close','</h3>');
$GLOBALS['debut_intertitre_2'] = lire_config('bte/titraille2open','<h4 class="spip">');
$GLOBALS['fin_intertitre_2'] = lire_config('bte/titraille2close','</h4>');
$GLOBALS['debut_intertitre_3'] = lire_config('bte/titraille3open','<h5 class="spip">');
$GLOBALS['fin_intertitre_3'] = lire_config('bte/titraille3close','</h5>');
$GLOBALS['debut_intertitre_4'] = lire_config('bte/titraille4open','<h6 class="spip">');
$GLOBALS['fin_intertitre_4'] = lire_config('bte/titraille4close','</h6>');
$GLOBALS['debut_intertitre_5'] = lire_config('bte/titraille5open','<strong class="spip titraille5">');
$GLOBALS['fin_intertitre_5'] = lire_config('bte/titraille5close','</strong>');
}
tester_variable('toujours_paragrapher', false);
global $debut_intertitre, $fin_intertitre;
global $debut_intertitre_2, $fin_intertitre_2;
global $debut_intertitre_3, $fin_intertitre_3;
global $debut_intertitre_4, $fin_intertitre_4;
global $debut_intertitre_5, $fin_intertitre_5;
$chercher_raccourcis=array();
$remplacer_raccourcis=array();
/* 9b */ $chercher_raccourcis[]="/(^|[^{])[{][{][{]\*\*\*\*\*(.*)[}][}][}]($|[^}])/SUms";
/* 9 */ $chercher_raccourcis[]="/(^|[^{])[{][{][{]\*\*\*\*(.*)[}][}][}]($|[^}])/SUms";
/* 7 */ $chercher_raccourcis[]="/(^|[^{])[{][{][{]\*\*\*(.*)[}][}][}]($|[^}])/SUms";
/* 5 */ $chercher_raccourcis[]="/(^|[^{])[{][{][{]\*\*(.*)[}][}][}]($|[^}])/SUms";
/* 3 */ $chercher_raccourcis[]="/(^|[^{])[{][{][{]\*(.*)[}][}][}]($|[^}])/SUms";
/* 1 */ $chercher_raccourcis[]="/(^|[^{])[{][{][{](.*)[}][}][}]($|[^}])/SUms";
/* 11 */ $chercher_raccourcis[]="/\{(<EFBFBD>|§)\{/S"; # § Pour gerer l'unicode aussi !
/* 12 */ $chercher_raccourcis[]="/\}(<EFBFBD>|§)\}/S"; # ne pas sauvergarder ce fichier en utf8 !
/* 9b */ $remplacer_raccourcis[]="\$1\n\n$debut_intertitre_5\$2$fin_intertitre_5\n\n\$3";
/* 9 */ $remplacer_raccourcis[]="\$1\n\n$debut_intertitre_4\$2$fin_intertitre_4\n\n\$3";
/* 7 */ $remplacer_raccourcis[]="\$1\n\n$debut_intertitre_3\$2$fin_intertitre_3\n\n\$3";
/* 5 */ $remplacer_raccourcis[]="\$1\n\n$debut_intertitre_2\$2$fin_intertitre_2\n\n\$3";
/* 3 */ $remplacer_raccourcis[]="\$1\n\n$debut_intertitre\$2$fin_intertitre\n\n\$3";
/* 1 */ $remplacer_raccourcis[]="\$1\n\n$debut_intertitre\$2$fin_intertitre\n\n\$3";
/* 11 */ $remplacer_raccourcis[]="<sc>";
/* 12 */ $remplacer_raccourcis[]="</sc>";
}
// Conversion des intertitres d'enluminures type {n{titre}n}
// ou n est un nombre en intertitres avec des etoiles type {{{* (avec n etoiles)
// {1{ sera converti en {{{* ; {2{ sera converti en {{{** ; etc.
// Ne faire la recherche que s'il y a au moins un titre ancienne mode a convertir
if (strpos($texte, '{1{')!==false
OR strpos($texte, '{2{')!==false
OR strpos($texte, '{3{')!==false
OR strpos($texte, '{4{')!==false
OR strpos($texte, '{5{')!==false) {
$texte=preg_replace_callback ("/\{(\d)\{(.*)\}(\\1)\}/Ums",
create_function (
'$matches',
'return "{{{".str_repeat("*",$matches[1]).trim($matches[2])."}}}";'
),
$texte);
}
$texte = preg_replace($chercher_raccourcis, $remplacer_raccourcis, $texte);
return $texte;
}
/**
* Insertion dans le pipeline post_propre (SPIP)
*
* Remplacement de caracteres apres le passage de propre
*
* @param $texte string
* Le texte a modifier
* @return $texte string
*/
function typoenluminee_post_propre($texte) {
if(!$texte) return $texte;
static $cherche1 = NULL;
static $remplace1 = NULL;
if ($cherche1===NULL) {
# Le remplacement des intertitres de premier niveau a deja ete effectue dans inc/texte.php
$cherche1 = array();
$remplace1 = array();
$cherche1[] = /* 15 */ ",\[/(.*)/\],Ums";
$cherche1[] = /* 16 */ ",\[!(.*)!\],Ums";
$cherche1[] = /* 17 */ ",\[\|(.*)\|\],Ums";
$cherche1[] = /* 19 */ ",\[\((.*)\)\],Ums";
$cherche1[] = /* 21 */ "/\[\*\*/S";
$cherche1[] = /* 21b */ "/\[\*/S";
$cherche1[] = /* 22 */ "/\*\]/S";
$remplace1[] = /* 15 */ "<div class=\"spip\" style=\"text-align:right;\">$1</div>";
$remplace1[] = /* 16 */ "<div class=\"spip\" style=\"text-align:left;\">$1</div>";
$remplace1[] = /* 17 */ "<div class=\"spip\" style=\"text-align:center;\">$1</div>";
$remplace1[] = /* 19 */ "<div class=\"texteencadre-spip spip\">$1</div>";
$remplace1[] = /* 21 */ "<strong class=\"caractencadre2-spip spip\">";
$remplace1[] = /* 21b */ "<strong class=\"caractencadre-spip spip\">";
$remplace1[] = /* 22 */ "</strong>";
}
$texte = preg_replace($cherche1, $remplace1, $texte);
$texte = paragrapher($texte,$GLOBALS['toujours_paragrapher']); // il faut reparagrapher a cause des raccourcis typo que l'on a ajoute (block div)
return $texte;
}
function typoenluminee_pre_liens($texte) {
if (!isset($GLOBALS['barre_typo_pas_de_fork_typo']) OR $GLOBALS['barre_typo_pas_de_fork_typo'] === true)
return $texte;
$texte = str_replace('<-->','&harr;',$texte);
$texte = str_replace('-->','&rarr;',$texte);
return $texte;
}
function typoenluminee_pre_typo($texte) {
if(!$texte) return $texte;
static $local_barre_typo_pas_de_fausses_puces = null;
static $chercher_raccourcis;
static $remplacer_raccourcis;
if (!isset($GLOBALS['barre_typo_pas_de_fork_typo']) OR $GLOBALS['barre_typo_pas_de_fork_typo'] === true)
return $texte;
if ($local_barre_typo_pas_de_fausses_puces===null){
// remplace les fausses listes a puce par de vraies ?
// (recherche en debut de lignes - suivi d'un ou plusieurs caracteres blancs, en mode multiligne)
// Mettre $GLOBALS['barre_typo_pas_de_fausses_puces'] = true; dans mes_options.php pour avoir ce comportement
if (isset($GLOBALS['barre_typo_pas_de_fausses_puces'])) {
$local_barre_typo_pas_de_fausses_puces = $GLOBALS['barre_typo_pas_de_fausses_puces'];
} else {
if (function_exists('lire_config')) {
$local_barre_typo_pas_de_fausses_puces = (lire_config('bte/puces','Non') == 'Oui')?true:false;
}
}
}
if ($local_barre_typo_pas_de_fausses_puces === true) {
$texte = preg_replace('/^-\s+/m','-* ',$texte);
}
$texte = str_replace('<--','&larr;',$texte);
$texte = str_replace('<==>','&hArr;',$texte);
$texte = str_replace('==>','&rArr;',$texte);
$texte = str_replace('<==','&lArr;',$texte);
$texte = str_ireplace('(c)','&copy;',$texte);
$texte = str_ireplace('(r)','&reg;',$texte);
$texte = str_ireplace('(tm)','&trade;',$texte);
$texte = str_replace('...','&hellip;',$texte);
global $debut_italique, $fin_italique,$class_spip;
/*
Cas particulier pour le gras
Il ne faut pas traiter la mise en gras ici si le texte contient un tableau
*/
if (!preg_match(',.(\|([[:space:]]*{{[^}]+}}[[:space:]]*|<))+.,sS', $texte)) {
$chercher_raccourcisg = array(
/* 7 */ "/(?<![{])[{][{](?![{])/S", // Expressions complexes car on n'a pas encore traite les titres ici
/* 8 */ "/(?<![}])[}][}](?![}])/S" // En gros, verification qu'on n'est pas a l'interieur d'un titre
);
$remplacer_raccourcisg = array(
/* 7 */ "<strong$class_spip>",
/* 8 */ "</strong>"
);
$texte = preg_replace($chercher_raccourcisg, $remplacer_raccourcisg, $texte);
}
/**
* Remplacer les { ... } par <i> </i>
* On passe après les gras pour que la regexp ne matche pas {{ ... }}
*/
tester_variable('debut_italique', "<i$class_spip>");
tester_variable('fin_italique', '</i>');
$chercher_raccourcis = array(
/* 9 */ "/(?<![{])[{](?![{])/S", // Expressions complexes car on n'a pas encore traite les titres ici
/* 10 */ "/(?<![}])[}](?![}])/S" // En gros, verification qu'on n'est pas a l'interieur d'un titre
);
$remplacer_raccourcis = array(
/* 9 */ $debut_italique,
/* 10 */ $fin_italique,
);
$texte = preg_replace($chercher_raccourcis, $remplacer_raccourcis, $texte);
return $texte;
}
function typoenluminee_post_typo($texte) {
if(!$texte) return $texte;
if (!isset($GLOBALS['barre_typo_pas_de_fork_typo']) OR $GLOBALS['barre_typo_pas_de_fork_typo'] === true)
return $texte;
$texte = str_replace('[^','<sup>',$texte);
$texte = str_replace('^]','</sup>',$texte);
$texte = str_replace('[**','<strong class="caractencadre2-spip spip">',$texte);
$texte = str_replace('[*','<strong class="caractencadre-spip spip">',$texte);
$texte = str_replace('*]','</strong>',$texte);
// Correction des & en &amp;
$texte = preg_replace('/&([A-Za-z#0-9]*);/','@@@amp:\1:amp@@@',$texte); // echapement des entites html deja presentes
$texte = str_replace('&','&amp;',$texte);
$texte = preg_replace('/@@@amp:([A-Za-z#0-9]*):amp@@@/','&\1;',$texte);
// Raccourci typographique <sc></sc>
$texte = str_replace('<sc>', '<span class="caps">', $texte);
$texte = str_replace('</sc>', '</span>', $texte);
$texte = acronymes_traiter_raccourcis($texte);
return $texte;
}
function typoenluminee_nettoyer_raccourcis_typo($texte){
$texte = preg_replace(',\{[1-5]\{,','',$texte);
$texte = preg_replace(',\}[1-5]\},','',$texte);
$texte = preg_replace(',\{\{\{\*+,','{{{',$texte);
$texte = str_replace('&hellip;','...',$texte);
return $texte;
}
// traite les raccourcis de la forme [SNCF|societe nationale...]
// reprise du plugin acronymes
if (!function_exists('acronymes_traiter_raccourcis')) {
function acronymes_traiter_raccourcis($letexte){
$pattern="{\[([^\|\]-]+)\|([^\|\]-]+)\]}";
if (preg_match_all ($pattern, $letexte, $tagMatches, PREG_SET_ORDER)) {
$textMatches = preg_split ($pattern, $letexte);
$tag_attr=array();
foreach ($tagMatches as $key => $value) {
$tag_attr[]="<acronym title='".texte_backend($value[2])."'>".$value[1]."</acronym>";
}
for ($i = 0; $i < count($tag_attr); $i ++) {
$textMatches [$i] = $textMatches [$i] . $tag_attr [$i];
}
return implode ("", $textMatches);
} else {
return $letexte;
}
}
}
?>
<?php
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
/**
* Ce plugin rajoute des raccourcis typographique et ameliore les possibilites de la barre typographique pour les redacteurs
*
*
* Fonctions de ces filtres :
* Ils rajoutent quelques racourcis typo a SPIP
*
* Syntaxe des raccourcis :
* [/texte/] : aligner le texte a droite
* [!texte!] : aligner le texte a gauche
* [|texte|] : centrer le texte
* [(texte)] : encadrer le texte (occupe toute la largeur de la page, a mettre autour d'un paragraphe)
* [*texte*] : encadrer/surligner le texte (une partie a l'interieur d'un paragraphe)
* [**texte*] : variante encadrer/surligner le texte (une partie a l'interieur d'un paragraphe)
* <sup>texte</sup> : mettre en exposant le texte selectionne
* <sub>texte</sub> : mettre en indice le texte selectionne
*
* Styles pour les encadrements a rajouter dans votre feuille de style :
* .texteencadre-spip {
* background: #FFE;
* border-bottom: 2px solid #999999;
* border-left: 1px solid #EEEEEE;
* border-right: 2px solid #999999;
* border-top: 1px solid #EEEEEE;
* padding: .25em;
* }
* .caractencadre-spip {
* border: 1px solid #666;
* padding: 0px .5em 0px .5em;
* }
*/
// Gerer les variables de personnalisation, fonction depreciee sous SPIP 2.0
// A suivre sur la methode...
if (!function_exists('tester_variable')) {
function tester_variable($var, $val) {
if (!isset($GLOBALS[$var])) {
$GLOBALS[$var] = $val;
}
}
}
function typoenluminee_pre_propre($texte) {
if (!$texte) {
return $texte;
}
static $chercher_raccourcis = null;
static $remplacer_raccourcis = null;
if ($chercher_raccourcis === null) {
// tous les elements block doivent etre introduits ici
// pour etre pris en charge par paragrapher
// Definition des differents intertitres possibles, si pas deja definies
if ((!function_exists('lire_config')) or (isset($GLOBALS['config_intertitre']))) {
tester_variable('debut_intertitre', '<h3 class="spip">');
tester_variable('fin_intertitre', '</h3>');
tester_variable('debut_intertitre_2', '<h4 class="spip">');
tester_variable('fin_intertitre_2', '</h4>');
tester_variable('debut_intertitre_3', '<h5 class="spip">');
tester_variable('fin_intertitre_3', '</h5>');
tester_variable('debut_intertitre_4', '<h6 class="spip">');
tester_variable('fin_intertitre_4', '</h6>');
tester_variable('debut_intertitre_5', '<strong class="spip titraille5">');
tester_variable('fin_intertitre_5', '</strong>');
} else {
$GLOBALS['debut_intertitre'] = lire_config('bte/titraille1open', '<h3 class="spip">');
$GLOBALS['fin_intertitre'] = lire_config('bte/titraille1close', '</h3>');
$GLOBALS['debut_intertitre_2'] = lire_config('bte/titraille2open', '<h4 class="spip">');
$GLOBALS['fin_intertitre_2'] = lire_config('bte/titraille2close', '</h4>');
$GLOBALS['debut_intertitre_3'] = lire_config('bte/titraille3open', '<h5 class="spip">');
$GLOBALS['fin_intertitre_3'] = lire_config('bte/titraille3close', '</h5>');
$GLOBALS['debut_intertitre_4'] = lire_config('bte/titraille4open', '<h6 class="spip">');
$GLOBALS['fin_intertitre_4'] = lire_config('bte/titraille4close', '</h6>');
$GLOBALS['debut_intertitre_5'] = lire_config('bte/titraille5open', '<strong class="spip titraille5">');
$GLOBALS['fin_intertitre_5'] = lire_config('bte/titraille5close', '</strong>');
}
tester_variable('toujours_paragrapher', false);
global $debut_intertitre, $fin_intertitre;
global $debut_intertitre_2, $fin_intertitre_2;
global $debut_intertitre_3, $fin_intertitre_3;
global $debut_intertitre_4, $fin_intertitre_4;
global $debut_intertitre_5, $fin_intertitre_5;
$chercher_raccourcis=array();
$remplacer_raccourcis=array();
/* 9b */ $chercher_raccourcis[] = '/(^|[^{])[{][{][{]\*\*\*\*\*(.*)[}][}][}]($|[^}])/SUms';
/* 9 */ $chercher_raccourcis[] = '/(^|[^{])[{][{][{]\*\*\*\*(.*)[}][}][}]($|[^}])/SUms';
/* 7 */ $chercher_raccourcis[] = '/(^|[^{])[{][{][{]\*\*\*(.*)[}][}][}]($|[^}])/SUms';
/* 5 */ $chercher_raccourcis[] = '/(^|[^{])[{][{][{]\*\*(.*)[}][}][}]($|[^}])/SUms';
/* 3 */ $chercher_raccourcis[] = '/(^|[^{])[{][{][{]\*(.*)[}][}][}]($|[^}])/SUms';
/* 1 */ $chercher_raccourcis[] = '/(^|[^{])[{][{][{](.*)[}][}][}]($|[^}])/SUms';
/* 11 */ $chercher_raccourcis[] = '/\{(<EFBFBD>|§)\{/S'; # § Pour gerer l'unicode aussi !
/* 12 */ $chercher_raccourcis[] = '/\}(<EFBFBD>|§)\}/S'; # ne pas sauvergarder ce fichier en utf8 !
/* 9b */ $remplacer_raccourcis[] = "\$1\n\n$debut_intertitre_5\$2$fin_intertitre_5\n\n\$3";
/* 9 */ $remplacer_raccourcis[] = "\$1\n\n$debut_intertitre_4\$2$fin_intertitre_4\n\n\$3";
/* 7 */ $remplacer_raccourcis[] = "\$1\n\n$debut_intertitre_3\$2$fin_intertitre_3\n\n\$3";
/* 5 */ $remplacer_raccourcis[] = "\$1\n\n$debut_intertitre_2\$2$fin_intertitre_2\n\n\$3";
/* 3 */ $remplacer_raccourcis[] = "\$1\n\n$debut_intertitre\$2$fin_intertitre\n\n\$3";
/* 1 */ $remplacer_raccourcis[] = "\$1\n\n$debut_intertitre\$2$fin_intertitre\n\n\$3";
/* 11 */ $remplacer_raccourcis[] = '<sc>';
/* 12 */ $remplacer_raccourcis[] = '</sc>';
}
// Conversion des intertitres d'enluminures type {n{titre}n}
// ou n est un nombre en intertitres avec des etoiles type {{{* (avec n etoiles)
// {1{ sera converti en {{{* ; {2{ sera converti en {{{** ; etc.
// Ne faire la recherche que s'il y a au moins un titre ancienne mode a convertir
if (strpos($texte, '{1{') !== false
or strpos($texte, '{2{') !== false
or strpos($texte, '{3{') !== false
or strpos($texte, '{4{') !== false
or strpos($texte, '{5{') !== false) {
$texte = preg_replace_callback(
'/\{(\d)\{(.*)\}(\\1)\}/Ums',
create_function(
'$matches',
'return "{{{".str_repeat("*",$matches[1]).trim($matches[2])."}}}";'
),
$texte
);
}
$texte = preg_replace($chercher_raccourcis, $remplacer_raccourcis, $texte);
return $texte;
}
/**
* Insertion dans le pipeline post_propre (SPIP)
*
* Remplacement de caracteres apres le passage de propre
*
* @param $texte string
* Le texte a modifier
* @return $texte string
*/
function typoenluminee_post_propre($texte) {
if (!$texte) {
return $texte;
}
static $cherche1 = null;
static $remplace1 = null;
if ($cherche1=== null) {
# Le remplacement des intertitres de premier niveau a deja ete effectue dans inc/texte.php
$cherche1 = array();
$remplace1 = array();
$cherche1[] = /* 15 */ ',\[/(.*)/\],Ums';
$cherche1[] = /* 16 */ ',\[!(.*)!\],Ums';
$cherche1[] = /* 17 */ ',\[\|(.*)\|\],Ums';
$cherche1[] = /* 19 */ ',\[\((.*)\)\],Ums';
$cherche1[] = /* 21 */ '/\[\*\*/S';
$cherche1[] = /* 21b */ '/\[\*/S';
$cherche1[] = /* 22 */ '/\*\]/S';
$remplace1[] = /* 15 */ '<div class="spip" style="text-align:right;">$1</div>';
$remplace1[] = /* 16 */ '<div class="spip" style="text-align:left;">$1</div>';
$remplace1[] = /* 17 */ '<div class="spip" style="text-align:center;">$1</div>';
$remplace1[] = /* 19 */ '<div class="texteencadre-spip spip">$1</div>';
$remplace1[] = /* 21 */ '<strong class="caractencadre2-spip spip">';
$remplace1[] = /* 21b */ '<strong class="caractencadre-spip spip">';
$remplace1[] = /* 22 */ '</strong>';
}
$texte = preg_replace($cherche1, $remplace1, $texte);
$texte = paragrapher($texte, $GLOBALS['toujours_paragrapher']); // il faut reparagrapher a cause des raccourcis typo que l'on a ajoute (block div)
return $texte;
}
function typoenluminee_pre_liens($texte) {
if (!isset($GLOBALS['barre_typo_pas_de_fork_typo']) or $GLOBALS['barre_typo_pas_de_fork_typo'] === true) {
return $texte;
}
$texte = str_replace('<-->', '&harr;', $texte);
$texte = str_replace('-->', '&rarr;', $texte);
return $texte;
}
function typoenluminee_pre_typo($texte) {
if (!$texte) {
return $texte;
}
static $local_barre_typo_pas_de_fausses_puces = null;
static $chercher_raccourcis;
static $remplacer_raccourcis;
if (!isset($GLOBALS['barre_typo_pas_de_fork_typo']) or $GLOBALS['barre_typo_pas_de_fork_typo'] === true) {
return $texte;
}
if ($local_barre_typo_pas_de_fausses_puces === null) {
// remplace les fausses listes a puce par de vraies ?
// (recherche en debut de lignes - suivi d'un ou plusieurs caracteres blancs, en mode multiligne)
// Mettre $GLOBALS['barre_typo_pas_de_fausses_puces'] = true; dans mes_options.php pour avoir ce comportement
if (isset($GLOBALS['barre_typo_pas_de_fausses_puces'])) {
$local_barre_typo_pas_de_fausses_puces = $GLOBALS['barre_typo_pas_de_fausses_puces'];
} else {
if (function_exists('lire_config')) {
$local_barre_typo_pas_de_fausses_puces = (lire_config('bte/puces', 'Non') == 'Oui') ? true : false;
}
}
}
if ($local_barre_typo_pas_de_fausses_puces === true) {
$texte = preg_replace('/^-\s+/m', '-* ', $texte);
}
$texte = str_replace('<--', '&larr;', $texte);
$texte = str_replace('<==>', '&hArr;', $texte);
$texte = str_replace('==>', '&rArr;', $texte);
$texte = str_replace('<==', '&lArr;', $texte);
$texte = str_ireplace('(c)', '&copy;', $texte);
$texte = str_ireplace('(r)', '&reg;', $texte);
$texte = str_ireplace('(tm)', '&trade;', $texte);
$texte = str_replace('...', '&hellip;', $texte);
global $debut_italique, $fin_italique,$class_spip;
/*
Cas particulier pour le gras
Il ne faut pas traiter la mise en gras ici si le texte contient un tableau
*/
if (!preg_match(',.(\|([[:space:]]*{{[^}]+}}[[:space:]]*|<))+.,sS', $texte)) {
$chercher_raccourcisg = array(
/* 7 */ '/(?<![{])[{][{](?![{])/S', // Expressions complexes car on n'a pas encore traite les titres ici
/* 8 */ '/(?<![}])[}][}](?![}])/S' // En gros, verification qu'on n'est pas a l'interieur d'un titre
);
$remplacer_raccourcisg = array(
/* 7 */ "<strong$class_spip>",
/* 8 */ '</strong>'
);
$texte = preg_replace($chercher_raccourcisg, $remplacer_raccourcisg, $texte);
}
/**
* Remplacer les { ... } par <i> </i>
* On passe après les gras pour que la regexp ne matche pas {{ ... }}
*/
tester_variable('debut_italique', "<i$class_spip>");
tester_variable('fin_italique', '</i>');
$chercher_raccourcis = array(
/* 9 */ '/(?<![{])[{](?![{])/S', // Expressions complexes car on n'a pas encore traite les titres ici
/* 10 */ '/(?<![}])[}](?![}])/S' // En gros, verification qu'on n'est pas a l'interieur d'un titre
);
$remplacer_raccourcis = array(
/* 9 */ $debut_italique,
/* 10 */ $fin_italique,
);
$texte = preg_replace($chercher_raccourcis, $remplacer_raccourcis, $texte);
return $texte;
}
function typoenluminee_post_typo($texte) {
if (!$texte) {
return $texte;
}
if (!isset($GLOBALS['barre_typo_pas_de_fork_typo']) or $GLOBALS['barre_typo_pas_de_fork_typo'] === true) {
return $texte;
}
$texte = str_replace('[^', '<sup>', $texte);
$texte = str_replace('^]', '</sup>', $texte);
$texte = str_replace('[**', '<strong class="caractencadre2-spip spip">', $texte);
$texte = str_replace('[*', '<strong class="caractencadre-spip spip">', $texte);
$texte = str_replace('*]', '</strong>', $texte);
// Correction des & en &amp;
$texte = preg_replace('/&([A-Za-z#0-9]*);/', '@@@amp:\1:amp@@@', $texte); // echapement des entites html deja presentes
$texte = str_replace('&', '&amp;', $texte);
$texte = preg_replace('/@@@amp:([A-Za-z#0-9]*):amp@@@/', '&\1;', $texte);
// Raccourci typographique <sc></sc>
$texte = str_replace('<sc>', '<span class="caps">', $texte);
$texte = str_replace('</sc>', '</span>', $texte);
$texte = acronymes_traiter_raccourcis($texte);
return $texte;
}
function typoenluminee_nettoyer_raccourcis_typo($texte) {
$texte = preg_replace(',\{[1-5]\{,', '', $texte);
$texte = preg_replace(',\}[1-5]\},', '', $texte);
$texte = preg_replace(',\{\{\{\*+,', '{{{', $texte);
$texte = str_replace('&hellip;', '...', $texte);
return $texte;
}
// traite les raccourcis de la forme [SNCF|societe nationale...]
// reprise du plugin acronymes
if (!function_exists('acronymes_traiter_raccourcis')) {
function acronymes_traiter_raccourcis($letexte) {
$pattern = '{\[([^\|\]-]+)\|([^\|\]-]+)\]}';
if (preg_match_all($pattern, $letexte, $tagMatches, PREG_SET_ORDER)) {
$textMatches = preg_split($pattern, $letexte);
$tag_attr=array();
foreach ($tagMatches as $key => $value) {
$tag_attr[] = "<acronym title='".texte_backend($value[2])."'>".$value[1].'</acronym>';
}
for ($i = 0; $i < count($tag_attr); $i ++) {
$textMatches [$i] = $textMatches [$i] . $tag_attr [$i];
}
return implode('', $textMatches);
} else {
return $letexte;
}
}
}

33
typoenluminee_administrations.php

@ -1,16 +1,18 @@
<?php
if (!defined("_ECRIRE_INC_VERSION")) return;
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
/**
* Fonction d'installation et MAJ plugin
*
*
* @param string $nom_meta_base_version
* Nom de la meta d'installation du plugin
* @param float $version_cible
* Version vers laquelle mettre à jour
*/
function typoenluminee_upgrade($nom_meta_base_version,$version_cible){
function typoenluminee_upgrade($nom_meta_base_version, $version_cible) {
$maj = array();
$maj['create'] = array(
@ -23,24 +25,25 @@ function typoenluminee_upgrade($nom_meta_base_version,$version_cible){
/**
* Abandon de l'ancienne écriture des intertitres
*
*
* {1{...}1} {2{...}2} {3{...}3} {4{...}4} {5{...}5} en intertitres avec étoiles :
* {{{...}}} {{{**...}}} {{{***...}}} {{{****...}}} {{{*****...}}}
*
*
*/
function maj_titres_enlumines(){
$anciens_titres = sql_allfetsel('id_article,texte','spip_articles','texte LIKE "%{1{%" OR texte LIKE "%{2{%" OR texte LIKE "%{3{%" OR texte LIKE "%{4{%" OR texte LIKE "%{5{%"');
foreach($anciens_titres as $cle => $article){
function maj_titres_enlumines() {
$anciens_titres = sql_allfetsel('id_article, texte', 'spip_articles', 'texte LIKE "%{1{%" OR texte LIKE "%{2{%" OR texte LIKE "%{3{%" OR texte LIKE "%{4{%" OR texte LIKE "%{5{%"');
foreach ($anciens_titres as $cle => $article) {
$id_article = $article['id_article'];
$article['texte'] = preg_replace('/({1{)(.*)(}1})/Uims','{{{\\2}}}',$article['texte']);
$article['texte'] = preg_replace('/({2{)(.*)(}2})/Uims','{{{**\\2}}}',$article['texte']);
$article['texte'] = preg_replace('/({3{)(.*)(}3})/Uims','{{{***\\2}}}',$article['texte']);
$article['texte'] = preg_replace('/({4{)(.*)(}4})/Uims','{{{****\\2}}}',$article['texte']);
$article['texte'] = preg_replace('/({5{)(.*)(}5})/Uims','{{{*****\\2}}}',$article['texte']);
$article['texte'] = preg_replace('/({1{)(.*)(}1})/Uims', '{{{\\2}}}', $article['texte']);
$article['texte'] = preg_replace('/({2{)(.*)(}2})/Uims', '{{{**\\2}}}', $article['texte']);
$article['texte'] = preg_replace('/({3{)(.*)(}3})/Uims', '{{{***\\2}}}', $article['texte']);
$article['texte'] = preg_replace('/({4{)(.*)(}4})/Uims', '{{{****\\2}}}', $article['texte']);
$article['texte'] = preg_replace('/({5{)(.*)(}5})/Uims', '{{{*****\\2}}}', $article['texte']);
$article['texte'] = trim($article['texte']);
sql_updateq('spip_articles',array('texte' => $article['texte']),'id_article='.intval($article['id_article']));
if (time() >= _TIME_OUT)
sql_updateq('spip_articles', array('texte' => $article['texte']), 'id_article='.intval($article['id_article']));
if (time() >= _TIME_OUT) {
return;
}
}
}

32
typoenluminee_options.php

@ -1,15 +1,17 @@
<?php
if (!defined("_ECRIRE_INC_VERSION")) return;
/**
* Autoriser les tag <b>, <i>, <em>, <sc> et <br />
* dans le nom/signature d'un auteur.
*
* Par defaut, <multi> est toujours autorise.
* Cf : http://www.spip.net/fr_article5666.html
* Cf : http://core.spip.org/projects/spip/repository/revisions/21016 a 21018
*/
if (!defined('_TAGS_NOM_AUTEUR')) define('_TAGS_NOM_AUTEUR', 'b, i, em, sc, br');
?>
<?php
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
/**
* Autoriser les tag <b>, <i>, <em>, <sc> et <br />
* dans le nom/signature d'un auteur.
*
* Par defaut, <multi> est toujours autorise.
* Cf : http://www.spip.net/fr_article5666.html
* Cf : http://core.spip.org/projects/spip/repository/revisions/21016 a 21018
*/
if (!defined('_TAGS_NOM_AUTEUR')) {
define('_TAGS_NOM_AUTEUR', 'b, i, em, sc, br');
}

63
typoenluminee_pipelines.php

@ -1,30 +1,33 @@
<?php
if (!defined("_ECRIRE_INC_VERSION")) return;
// insert le css pour les styles supplementaires de la BTE dans le <head> du document (#INSERT_HEAD)
function TypoEnluminee_insert_head_css($flux) {
static $done = false;
if (!$done) {
$done = true;
if (isset($GLOBALS['BarreTypoEnrichie_Preserve_Header']) OR !function_exists('lire_config'))
global $BarreTypoEnrichie_Preserve_Header;
else
$BarreTypoEnrichie_Preserve_Header = lire_config('bte/insertcss','Oui');
if ($BarreTypoEnrichie_Preserve_Header == 'Oui')
$flux .= "\n".'<link rel="stylesheet" href="'.find_in_path('css/enluminurestypo.css').'" type="text/css" media="all" />';
}
return $flux;
}
// insert le css pour les styles supplementaires de la BTE dans le <head> du document (#INSERT_HEAD)
function TypoEnluminee_insert_head($flux) {
$flux = TypoEnluminee_insert_head_css($flux);
return $flux;
}
function TypoEnluminee_header_prive($texte) {
$texte.= '<link rel="stylesheet" type="text/css" href="' . _DIR_PLUGIN_TYPOENLUMINEE . 'css/enluminurestypo.css" />' . "\n";
$texte.= '<link rel="stylesheet" type="text/css" href="' . _DIR_PLUGIN_TYPOENLUMINEE . 'css/enluminurestypo_prive.css" />' . "\n";
return $texte;
}
?>
<?php
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
// insert le css pour les styles supplementaires de la BTE dans le <head> du document (#INSERT_HEAD)
function TypoEnluminee_insert_head_css($flux) {
static $done = false;
if (!$done) {
$done = true;
if (isset($GLOBALS['BarreTypoEnrichie_Preserve_Header']) or !function_exists('lire_config')) {
global $BarreTypoEnrichie_Preserve_Header;
} else {
$BarreTypoEnrichie_Preserve_Header = lire_config('bte/insertcss', 'Oui');
}
if ($BarreTypoEnrichie_Preserve_Header == 'Oui') {
$flux .= "\n".'<link rel="stylesheet" href="'.find_in_path('css/enluminurestypo.css').'" type="text/css" media="all" />';
}
}
return $flux;
}
// insert le css pour les styles supplementaires de la BTE dans le <head> du document (#INSERT_HEAD)
function TypoEnluminee_insert_head($flux) {
$flux = TypoEnluminee_insert_head_css($flux);
return $flux;
}
function TypoEnluminee_header_prive($texte) {
$texte.= '<link rel="stylesheet" type="text/css" href="' . _DIR_PLUGIN_TYPOENLUMINEE . 'css/enluminurestypo.css" />' . "\n";
$texte.= '<link rel="stylesheet" type="text/css" href="' . _DIR_PLUGIN_TYPOENLUMINEE . 'css/enluminurestypo_prive.css" />' . "\n";
return $texte;
}

Loading…
Cancel
Save