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, adapté para RC3 y RC4 el siguiente MOD:
http://custom.simplemachines.org/mods/index.php?mod=716Todos los creditos son del autor del mod:
tFF(me gusta mas este mod porque permite el uso de BBC)
en ./Sources/Subs.phpbuscar:
// 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 - ed2kbuscar:
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 - ed2kbuscar:
// Inside these tags autolink is not recommendable.
$no_autolink_tags = array(Agregar despues:
// tFF - ed2k
'ed2k',
// /tFF - ed2kBuscar:
// 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 - ed2kBuscar:
}
}
$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 - ed2ken ./Sources/Subs-Editor.phpBuscar:
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:
tFFSaludos.