Closed (outdated)
Project:
Custom Tokens
Version:
6.x-1.2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
3 Jan 2011 at 04:52 UTC
Updated:
18 Nov 2019 at 17:59 UTC
Jump to comment: Most recent
hi i dont know can we say to this matter "bug" or not
class HijriCalendar{
function monthName($i) // $i = 1..12
{
static $month = array(
"محرم", "صفر", "ربيعالاول", "ربيعالثاني",
"جماديالاول", "جماديالثاني", "رجب", "شعبان",
"رمضان", "شوال", "ذيالقعده", "ذيالحجه"
);
return $month[$i-1];
}
function GregorianToHijri($time = null,$calender_tolerance_var=0)
{
if ($time === null) $time = time();
$m = date('m', $time);
$d = date('d', $time);
$y = date('Y', $time);
return HijriCalendar::JDToHijri(
cal_to_jd(CAL_GREGORIAN, $m, $d, $y)+$calender_tolerance_var);
}
function HijriToGregorian($m, $d, $y)
{
return jd_to_cal(CAL_GREGORIAN,
HijriCalendar::HijriToJD($m, $d, $y)+$calender_tolerance_var);
}
# Julian Day Count To Hijri
function JDToHijri($jd)
{
$jd = $jd - 1948440 + 10632;
$n = (int)(($jd - 1) / 10631);
$jd = $jd - 10631 * $n + 354;
$j = ((int)((10985 - $jd) / 5316)) *
((int)(50 * $jd / 17719)) +
((int)($jd / 5670)) *
((int)(43 * $jd / 15238));
$jd = $jd - ((int)((30 - $j) / 15)) *
((int)((17719 * $j) / 50)) -
((int)($j / 16)) *
((int)((15238 * $j) / 43)) + 29;
$m = (int)(24 * $jd / 709);
$d = $jd - (int)(709 * $m / 24);
$y = 30*$n + $j - 30;
return array($m, $d, $y);
}
# Hijri To Julian Day Count
function HijriToJD($m, $d, $y)
{
return (int)((11 * $y + 3) / 30) +
354 * $y + 30 * $m -
(int)(($m - 1) / 2) + $d + 1948440 - 385;
}
};
$hijri = HijriCalendar::GregorianToHijri( time() , 1 );
echo token_replace('[token_custom_today_note]').'/'.$hijri[0].'/'.$hijri[1].'/'.'htmlfile';//'. '' '.$hijri[2];
this code return me
Fatal error: Cannot redeclare class HijriCalendar in /home/islamor/public_html/sites/all/modules/token_custom/token_custom.module(31) : eval()'d code on line 1
1- can i use new class in this section
2- can i use new variant in my code without conflict variant names issue
Comments
Comment #1
manuel.adan