INICIO
Como poner emoticonos en la wiki PDF Imprimir Correo electrónico
REDES - WEBMASTER

Este artículo trata sobre cómo subir emoticonos a tu wiki para hacerla mas personal.

 

El primer paso es:

 

  • Crear un fichero con este texto:
 
<?php

# Emoticon MediaWiki Extension
# Created by Alex Wollangk ( Esta dirección electrónica esta protegida contra spambots. Es necesario activar Javascript para visualizarla )

if ( !defined( 'MEDIAWIKI' ) ) {
die( 'This file is a MediaWiki extension, it is not a valid entry point' );
}

global $wgHooks;
global $wgExtensionCredits;

$wgExtensionCredits['parserhook'][] = array(
'name' => 'Emoticons',
'status' => 'stable',
'type' => 'hook',
'author' => 'Alex Wollangk ( Esta dirección electrónica esta protegida contra spambots. Es necesario activar Javascript para visualizarla )',
'version' => '1.0',
'update' => '2-20-2007',
'url' => 'http://www.mediawiki.org/wiki/Extension:Emoticons',
'description' => 'Enable forum-style emoticon (smiley) replacement within MediaWiki.',
);

$wgHooks['ParserAfterStrip'][] = 'fnEmoticons';

// The callback function for replacing emoticons with image tags
function fnEmoticons( &$parser, &$text, &$strip_state ) {
global $action; // Access the global "action" variable
// Only do the replacement if the action is not edit or history
if(
$action !== 'edit'
&& $action !== 'history'
&& $action !== 'delete'
&& $action !== 'watch'
&& strpos( $parser->mTitle->mPrefixedText, 'Special:' ) === false
&& $parser->mTitle->mNamespace !== 8
)
{
// Get the list of emoticons from the "MediaWiki:Emoticons" article.
$title = Title::makeTitle( 8, 'Emoticons' );
$emoticonListArticle = new Article( $title );
$emoticonListArticle->getContent();

// If the content successfully loaded, do the replacement
if( $emoticonListArticle->mContentLoaded )
{
$emoticonList = explode( "\n", $emoticonListArticle->mContent );
foreach( $emoticonList as $index => $emoticon )
{
$currEmoticon = explode( "//", $emoticon, 2 );
if( count($currEmoticon) == 2 )
{
// start by trimming the search value
$currEmoticon[ 0 ] = trim( $currEmoticon[ 0 ] );
// if the string begins with  , lop it off
if( substr( $currEmoticon[ 0 ], 0, 6 ) == ' ' )
{
$currEmoticon[ 0 ] = trim( substr( $currEmoticon[ 0 ], 6 ) );
}
// trim the replacement value
$currEmoticon[ 1 ] = trim( $currEmoticon[ 1 ] );
// and finally perform the replacement
$text = str_replace( $currEmoticon[ 0 ], $currEmoticon[ 1 ], $text );
}
}
}
}
// Always a good practice to let the other hooks have their turn ... whenever it make sense.
return true;
}
  • Guardarlo con el nombre emoticons.php
  • Guardarlo en extensions

El segundo paso:

  • Bajar el fichero localsettings.php
  • Modificarlo con la frase:
require_once( "extensions/emoticons.php" );
  •  Volver a subir el fichero localsetting.php

El tercer paso es:

  • En tu wiki crear una pagina que se llame emoticonos
  • Editarla copiando:
 
 :D//[[Image:VeryHappy.gif]]
:-D//[[Image:VeryHappy.gif]]
:grin://[[Image:VeryHappy.gif]]
:)//[[Image:Smile.gif]]
:-)//[[Image:Smile.gif]]
:smile://[[Image:Smile.gif]]
:(//[[Image:Sad.gif]]
:-(//[[Image:Sad.gif]]
:sad://[[Image:Sad.gif]]
:o//[[Image:Surprised.gif]]
:-o//[[Image:Surprised.gif]]
:eek://[[Image:Surprised.gif]]
:shock://[[Image:Shocked.gif]]
:?//[[Image:Confused.gif]]
:-?//[[Image:Confused.gif]]
:???://[[Image:Confused.gif]]
8)//[[Image:Cool.gif]]
8-)//[[Image:Cool.gif]]
:cool://[[Image:Cool.gif]]
:lol://[[Image:Laughing.gif]]
:x//[[Image:Mad.gif]]
:-x//[[Image:Mad.gif]]
:mad://[[Image:Mad.gif]]
:P//[[Image:Razz.gif]]
:-P//[[Image:Razz.gif]]
:razz://[[Image:Razz.gif]]
:oops://[[Image:Embarassed.gif]]
:cry://[[Image:CryingorVerySad.gif]]
:evil://[[Image:EvilorVeryMad.gif]]
:twisted://[[Image:TwistedEvil.gif]]
:roll://[[Image:RollingEyes.gif]]
:wink://[[Image:Wink.gif]]
;)//[[Image:Wink.gif]]
;-)//[[Image:Wink.gif]]
:!://[[Image:Exclamation.gif]]
:?://[[Image:Question.gif]]
:idea://[[Image:Idea.gif]]
:arrow://[[Image:Arrow.gif]]
:|//[[Image:Neutral.gif]]
:-|//[[Image:Neutral.gif]]
:neutral://[[Image:Neutral.gif]]
:mrgreen://[[Image:Mr.Green.gif]]
  • Guardar la pagina


Para ver mejor este ejemplo ir a:

http://wikimusica.enlaonda.es/wiki

 

Ultima actualización ( 24 de Octubre de 2008 )