Discussion utilisateur:P'skhal
De Mystpedia.
(Différences entre les versions)
m |
|||
| (Une version intermédiaire masquée) | |||
| Ligne 1 : | Ligne 1 : | ||
Je me permet de placer ton tableau dans la rubrique Aide. Pour que ceux qui en auraient besoin l'ai avec les autres, plus simples. --[[Utilisateur:Zoorin|Zoorin]] 24 mars 2010 à 15:33 (UTC) | Je me permet de placer ton tableau dans la rubrique Aide. Pour que ceux qui en auraient besoin l'ai avec les autres, plus simples. --[[Utilisateur:Zoorin|Zoorin]] 24 mars 2010 à 15:33 (UTC) | ||
| + | ---- | ||
| + | fichier : LocalSettings.php | ||
| + | <pre> | ||
| + | # chargement de l'extension | ||
| + | require_once( "$IP/extensions/EcritDni/EcritDni.php" ); | ||
| + | |||
| + | #activation de l'autocompletion dans le formulaire de recherche | ||
| + | $wgEnableMWSuggest= true; | ||
| + | </pre> | ||
| + | |||
| + | fichier : EcritDni.php | ||
| + | <pre> | ||
| + | <?php | ||
| + | |||
| + | # This program is free software; you can redistribute it and/or modify | ||
| + | # it under the terms of the GNU General Public License as published by | ||
| + | # the Free Software Foundation; either version 2 of the License, or | ||
| + | # (at your option) any later version. | ||
| + | # | ||
| + | # This program is distributed in the hope that it will be useful, | ||
| + | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| + | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| + | # GNU General Public License for more details. | ||
| + | # | ||
| + | # You should have received a copy of the GNU General Public License along | ||
| + | # with this program; if not, write to the Free Software Foundation, Inc., | ||
| + | # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| + | # http://www.gnu.org/copyleft/gpl.html | ||
| + | |||
| + | /* | ||
| + | * Extension to insert characters using Cyan font "Dnifont" (Copyright) | ||
| + | * | ||
| + | * @author P'skhal for Mystpedia (http://www.mystpedia.net) | ||
| + | */ | ||
| + | |||
| + | $wgExtensionCredits['parserhook'][] = array( | ||
| + | 'name' => 'EcritDni', | ||
| + | 'author' =>'Pskhal', | ||
| + | 'url' => 'http://www.mystpedia.net/mystpedia/index.php?title=Utilisateur:P%27skhal', | ||
| + | 'description' => 'This extension should render text with Cyan Dnifont, I hope so' | ||
| + | ); | ||
| + | |||
| + | $wgExtensionFunctions[] = "EcritDni"; | ||
| + | |||
| + | function EcritDni() { | ||
| + | global $wgParser; | ||
| + | $wgParser->setHook("dniL","transcritLDni"); | ||
| + | $wgParser->setHook("dniN","transcritNDni"); | ||
| + | } | ||
| + | |||
| + | function transcritLDni($str, $argv, $parser) { | ||
| + | return '<span style="font: 14pt Dnifont; ">'.$str.'</span>'; | ||
| + | |||
| + | } | ||
| + | |||
| + | function transcritNDni($str, $argv, $parser) { | ||
| + | return '<span style="font: 20pt Dnifont; ">'.charInsertDisp( $str ).'</span>'; | ||
| + | } | ||
| + | |||
| + | function charInsertDisp( $text ) { | ||
| + | static $codes = array('[0]','[1]','[2]','[3]','[4]','[5]','[6]','[7]','[8]','[9]', '[10]', '[11]', '[12]', '[13]', '[14]', '[15]', '[16]', '[17]', '[18]', '[19]', '[20]', '[21]', '[22]', '[23]', '[24]', '[25]'); | ||
| + | static $carac = array( '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' ,')','!','@','#','$','%','^','&','*','(','[',']','\','{','}','|'); | ||
| + | return str_replace( $codes, $carac, $text ); | ||
| + | } | ||
| + | |||
| + | ?> | ||
| + | </pre> | ||
| + | [[Utilisateur:P'skhal|P'skhal]] 9 juin 2010 à 20:48 (UTC) | ||
Version actuelle en date du 9 juin 2010 à 20:48
Je me permet de placer ton tableau dans la rubrique Aide. Pour que ceux qui en auraient besoin l'ai avec les autres, plus simples. --Zoorin 24 mars 2010 à 15:33 (UTC)
fichier : LocalSettings.php
# chargement de l'extension require_once( "$IP/extensions/EcritDni/EcritDni.php" ); #activation de l'autocompletion dans le formulaire de recherche $wgEnableMWSuggest= true;
fichier : EcritDni.php
<?php
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# http://www.gnu.org/copyleft/gpl.html
/*
* Extension to insert characters using Cyan font "Dnifont" (Copyright)
*
* @author P'skhal for Mystpedia (http://www.mystpedia.net)
*/
$wgExtensionCredits['parserhook'][] = array(
'name' => 'EcritDni',
'author' =>'Pskhal',
'url' => 'http://www.mystpedia.net/mystpedia/index.php?title=Utilisateur:P%27skhal',
'description' => 'This extension should render text with Cyan Dnifont, I hope so'
);
$wgExtensionFunctions[] = "EcritDni";
function EcritDni() {
global $wgParser;
$wgParser->setHook("dniL","transcritLDni");
$wgParser->setHook("dniN","transcritNDni");
}
function transcritLDni($str, $argv, $parser) {
return '<span style="font: 14pt Dnifont; ">'.$str.'</span>';
}
function transcritNDni($str, $argv, $parser) {
return '<span style="font: 20pt Dnifont; ">'.charInsertDisp( $str ).'</span>';
}
function charInsertDisp( $text ) {
static $codes = array('[0]','[1]','[2]','[3]','[4]','[5]','[6]','[7]','[8]','[9]', '[10]', '[11]', '[12]', '[13]', '[14]', '[15]', '[16]', '[17]', '[18]', '[19]', '[20]', '[21]', '[22]', '[23]', '[24]', '[25]');
static $carac = array( '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' ,')','!','@','#','$','%','^','&','*','(','[',']','\','{','}','|');
return str_replace( $codes, $carac, $text );
}
?>
P'skhal 9 juin 2010 à 20:48 (UTC)
