Funcion Date en Español (Para creadores de Plugins o modificadores)
Hola amigos de MyBB-Es bueno pues alguna vez les an pasado a los que modifican y/o crean plugins (Night,Abdon, Himura, Solstice,Gypaete, etc, etc, P...

Hola amigos de MyBB-Es bueno pues alguna vez les an pasado a los que modifican y/o crean plugins
(Night,Abdon, Himura, Solstice,Gypaete, etc, etc, PERDON A LOS QUE NO MENCIONO OLVIDO SUS NOMBRES)

que al usar la funcion date(X); dependiendo la letra que pongan les sale en ingles por ejemplo

date("D") = Sun
date("l") = Sunday
date("F") = February
date("M") = Feb

y no hay forma de pasarlo a español pue e aqui una funcion muy util que TODO lo hace en español solo ponen fuera de la funcion donde lo usaran ponen la siguiente funcion

function my_date_es($format_MyBB_By_Ed,$date_MyBB=0) 
{ 
	$dias_MyBB=array("Lunes","Martes","Miercoles","Jueves","Viernes","Sabado","Domingo",); 
    $dias_MyBB_short=array("Dom","Lun","Mar","Mie","Jue","Vie","Sab"); 
    $meses_MyBB=array("","Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"); 
    $meses_MyBB_Short=array("","Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"); 
    if(ereg("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})",$date_MyBB,$mods_By_Ed)) { 
        if (checkdate($mods_By_Ed[2],$mods_By_Ed[3],$mods_By_Ed[1])) { 
            $date_MyBB=strtotime($date_MyBB); } else { return(-1); } } 
	elseif ($date_MyBB==0) { 
        $date_MyBB=time(); } 
    $valMyBB=explode("|",date ("a|A|B|d|D|F|g|G|h|H|i|I|j|l|L|m|M|n|O|r|s|S|t|T|U|w|W|Y|y|z|Z",$date_MyBB)); 
    $claves_by_Ed= array ("a","A","B","d","D","F","g","G","h","H","i","I","j","l","L","m","M","n","O","r","s","S","t","T","U","w","W","Y","y","z","Z"); 
    for ($i=0;$i<count($claves_by_Ed);$i++) { 
    $modsMyBB[$claves_by_Ed[$i]]=$valMyBB[$i]; } 
    $modsMyBB["D"]=$dias_MyBB_short[$modsMyBB["w"]]; 
    $modsMyBB["l"]=$dias_MyBB[$modsMyBB["w"]]; 
    $modsMyBB["F"]=$meses_MyBB[$modsMyBB["n"]]; 
    $modsMyBB["M"]=$meses_MyBB_Short[$modsMyBB["n"]]; 
    $modsMyBB["r"]=$modsMyBB["D"].", ".$modsMyBB["d"]." ".$modsMyBB["M"]." ".$modsMyBB["Y"]." ".$modsMyBB["H"].":".$modsMyBB["i"].":".$modsMyBB["s"]." ".$modsMyBB["O"]; 
    $modsMyBB["S"]="o"; 
    $Edo_MyBB='\\\\\\'; 
    $null=0; 
    $format=$format_MyBB_By_Ed; 
    $var_for=""; 
    for ($MyBB=0;$MyBB<strlen($format_MyBB_By_Ed);$MyBB++) { if ($null==1) { 
        $var_for.=$format{$MyBB}; 
        $null=0; } else { 
        if($format{$MyBB}==$Edo_MyBB) { 
        $null=1; } else { 
        if (isset($modsMyBB[$format[$MyBB]])){ 
        $var_for.=$modsMyBB[$format[$MyBB]]; } else { 
        $var_for.=$format{$MyBB}; }	} } } 
    return $var_for; 
}

y en su funcion la usan asi
my_date_es(X);
por les muestra por ejemplo:

my_date_es("D") = Dom
my_date_es("l") = Domingo
my_date_es("F") = Febero
my_date_es("M") = Feb

hay les va un ejemplo de como usarlo

<?php

if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook("index_start", "prueba");

function prueba_info()
{
	return array(
		"name"				=> "Prueba", 
		"description"		=> "", 
		"website"			=> "mailto:nicedo_eeos@hotmail.com",
		"author"			=> "Edson Ordaz Developer", 
		"authorsite"		=> "mailto:nicedo_eeos@hotmail.com",
		"version"			=> "1.0", 
		"compatibility"		=> "16*", 
	);
}

function prueba_activate(){
}
function prueba_deactivate(){
}
function prueba()
{
	global $header;
	$header = my_date_es("D - l - F - M");
}
function my_date_es($format_MyBB_By_Ed,$date_MyBB=0) 
{ 
	$dias_MyBB=array("Lunes","Martes","Miercoles","Jueves","Viernes","Sabado","Domingo",); 
    $dias_MyBB_short=array("Dom","Lun","Mar","Mie","Jue","Vie","Sab"); 
    $meses_MyBB=array("","Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"); 
    $meses_MyBB_Short=array("","Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"); 
    if(ereg("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})",$date_MyBB,$mods_By_Ed)) { 
        if (checkdate($mods_By_Ed[2],$mods_By_Ed[3],$mods_By_Ed[1])) { 
            $date_MyBB=strtotime($date_MyBB); } else { return(-1); } } 
	elseif ($date_MyBB==0) { 
        $date_MyBB=time(); } 
    $valMyBB=explode("|",date ("a|A|B|d|D|F|g|G|h|H|i|I|j|l|L|m|M|n|O|r|s|S|t|T|U|w|W|Y|y|z|Z",$date_MyBB)); 
    $claves_by_Ed= array ("a","A","B","d","D","F","g","G","h","H","i","I","j","l","L","m","M","n","O","r","s","S","t","T","U","w","W","Y","y","z","Z"); 
    for ($i=0;$i<count($claves_by_Ed);$i++) { 
    $modsMyBB[$claves_by_Ed[$i]]=$valMyBB[$i]; } 
    $modsMyBB["D"]=$dias_MyBB_short[$modsMyBB["w"]]; 
    $modsMyBB["l"]=$dias_MyBB[$modsMyBB["w"]]; 
    $modsMyBB["F"]=$meses_MyBB[$modsMyBB["n"]]; 
    $modsMyBB["M"]=$meses_MyBB_Short[$modsMyBB["n"]]; 
    $modsMyBB["r"]=$modsMyBB["D"].", ".$modsMyBB["d"]." ".$modsMyBB["M"]." ".$modsMyBB["Y"]." ".$modsMyBB["H"].":".$modsMyBB["i"].":".$modsMyBB["s"]." ".$modsMyBB["O"]; 
    $modsMyBB["S"]="o"; 
    $Edo_MyBB='\\\\\\'; 
    $null=0; 
    $format=$format_MyBB_By_Ed; 
    $var_for=""; 
    for ($MyBB=0;$MyBB<strlen($format_MyBB_By_Ed);$MyBB++) { if ($null==1) { 
        $var_for.=$format{$MyBB}; 
        $null=0; } else { 
        if($format{$MyBB}==$Edo_MyBB) { 
        $null=1; } else { 
        if (isset($modsMyBB[$format[$MyBB]])){ 
        $var_for.=$modsMyBB[$format[$MyBB]]; } else { 
        $var_for.=$format{$MyBB}; }	} } } 
    return $var_for; 
}
?>

Asi espero les guste y les sea util....
PD. Si decean que les modifique una funcion o algo en especial diganmelo y lo hago!!

Saludos!
Archivos Adjuntos

This forum uses Lukasz Tkacz MyBB addons.