Existen 2 MODs para soporte de enlaces ed2k, pero son para SMF 1.1.X. Basandome en lo que hizo lucas-ruroken en este tema (http://www.simplemachines.org/community/index.php?topic=378247.msg2601090#msg2601090), adapté para RC3 y RC4 el siguiente MOD:
http://custom.simplemachines.org/mods/index.php?mod=716
Todos los creditos son del autor del mod: tFF
(me gusta mas este mod porque permite el uso de BBC)
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg571.imageshack.us%2Fimg571%2F764%2Fed2kbbc.png&hash=51d268c3fefe0ab11900a106400fab53a9f0ce42)
en ./Sources/Subs.php
buscar:
// Parse bulletin board code in a string, as well as smileys optionally.
Agregar antes:
// tFF - ed2k
function ed2k_readableSize ($ed2k_link) {
preg_match('~(\s|^)(ed2k://\|file\|.+?\|(.+?)\|.+?)(\s|$)~i', $ed2k_link, $matches);
$size=$matches[3];
$loop = 0;
$suffix = array ("Bytes","KBytes","MBytes","GBytes","TBytes"); //TeraByte is max possible
while ( ($size > 1024) && ($loop < 4) ) { //loop shouldn't be > 4 so the TB is max
$loop++;
$size /= 1024;
}
return round($size, 2) . " " . $suffix[$loop];
}
// /tFF - ed2k
buscar:
array(
'tag' => 'email',
'type' => 'unparsed_content',
agregar antes:
// tFF - ed2k
array(
'tag' => 'ed2k',
'type' => 'unparsed_content',
'content' => '<img src="__ed2k_ico__" alt="ed2k: __ed2k_size__" title="ed2k: __ed2k_size__" /> <a href="$1">__ed2k_name__</a>',
'validate' => create_function('&$tag, &$data, $disabled', '
global $settings;
$humanSize = ed2k_readableSize($data);
$data = strtr($data, array(\'<br />\' => \'\', \' \' => \'\', \' \' => \'\'));
$ed2k_name = preg_replace(\'~(\s|^)(ed2k://\|file\|(.+?)\|.+?)(\s|$)~i\', \'$3\', $data );
$ed2k_ico = $settings[\'images_url\'] . \'/bbc/\' . \'ed2k.gif\';
$tag[\'content\'] = strtr($tag[\'content\'], array(\'__ed2k_name__\' => $ed2k_name, \'__ed2k_ico__\' => $ed2k_ico, \'__ed2k_size__\' => $humanSize));
'),
),
array(
'tag' => 'ed2k',
'type' => 'unparsed_equals',
'before' => '<img src="__ed2k_ico__" alt="ed2k: __ed2k_size__" title="ed2k: __ed2k_size__" /> <a href="$1">',
'after' => '</a>',
'validate' => create_function('&$tag, &$data, $disabled', '
global $settings;
$humanSize = ed2k_readableSize($data);
$data = strtr($data, array(\'<br />\' => \'\', \' \' => \'\', \' \' => \'\'));
$ed2k_ico = $settings[\'images_url\'] . \'/bbc/\' . \'ed2k.gif\';
$tag[\'before\'] = strtr($tag[\'before\'], array(\'__ed2k_ico__\' => $ed2k_ico, \'__ed2k_size__\' => $humanSize));
'),
'disabled_after' => ' ($1)',
),
// /tFF - ed2k
buscar:
// Inside these tags autolink is not recommendable.
$no_autolink_tags = array(
Agregar despues:
// tFF - ed2k
'ed2k',
// /tFF - ed2k
Buscar:
// Links are useless on paper... just show the link.
$disabled['ftp'] = true;
$disabled['url'] = true;
$disabled['iurl'] = true;
$disabled['email'] = true;
$disabled['flash'] = true;
agregar despues:
// tFF - ed2k
$disabled['ed2k'] = true;
// /tFF - ed2k
Buscar:
}
}
$data = strtr($data, array("\t" => ' '));
if (!empty($modSettings['fixLongWords']) && $modSettings['fixLongWords'] > 5)
Agregar antes:
// tFF - ed2k
// eDonkey links then...
if (!isset($disabled['ed2k']) && strpos($data, 'ed2k://') !== false)
{
$data = preg_replace('~(?<=[\s>\.(;\'"]|^)(ed2k://\|file\|(.+?)\|.+?)(?=[?,\s\[\]()*\\\]|$|<br />| |>|<|"|'|\.(?:\.|;| |\s|$|<br />))~i', '[ed2k]$1[/ed2k]', $data);
}
// /tFF - ed2k
en ./Sources/Subs-Editor.php
Buscar:
array(
'image' => 'ftp',
'code' => 'ftp',
'before' => '[ftp]',
'after' => '[/ftp]',
'description' => $txt['ftp']
),
array(),
agregar despues:
array(
'image' => 'ed2k',
'code' => 'ed2k',
'before' => '[ed2k]',
'after' => '[/ed2k]',
'description' => 'eMule'
),
array(),
ademas copiar el archivo "ed2k.gif" a :
/themes/TU-THEME/images/bbc
Repito, todos los creditos son del autor del mod: tFF
Saludos.
excelente Egar ;)
Quote from: lucas-ruroken on September 26, 2010, 09:22:24 PM
excelente Egar ;)
se hace lo que se puede sin conocimientos de PHP
;)
Muy bueno egar, ese es el espiritu de compartir :) xD
pero todo se aprende :P
funciona perfecto en SMF 2RC4...
Saludos
Hi,
exist a modification add all link with one button?
Buenas :)
Me acabo de registrar en el foro (Cosa que debería haber hecho hace algún tiempo) y he decidido reflotar este hilo (Lo siento) ya que es el único que habla del tema de los enlaces ed2k...
He seguido el tutorial que pone Egar en el primer mensaje sin problemas y acepta los elinks (Esto es en la versión 2.0.2 de smf, pero tengo algunos problemillas derivados de esto:
- No me deja usar el tag [ed2k=elink]descripción[/ed2k] me falla y no se muestra como es debido, haciendo el elink inutilizable
- No sustituye los caracteres especiales (Por ejemplo %20 por espacio) con lo que quedan, muchas veces enlaces ilegibles.
Bueno esa es mi lista de problemas, a ver si alguien se pasa por aquí y me puede ayudar, como he dicho antes, siento el reflote.
Saludos!