compile-errors.log
make: *** No targets specified and no makefile found. Stop.
make: *** No targets specified and no makefile found. Stop.
jdf.zep
namespace Jdate;
class Jdf
{
public function jdate( var format, var timestamp = "", var none = "", var time_zone = "Asia/Tehran", var tr_nums = "fa") {
var T_sec, ts, date, j_y, j_m, j_d, doy, kab, sl, out, i, sub, jdw, dny, key, avs, num, aks;
let T_sec = 0;
if (time_zone != "local")
{
date_default_timezone_set((time_zone === "") ? "Asia/Tehran" : time_zone);
}
let ts = T_sec + ((timestamp === "") ? time() : this->tr_num(timestamp));
let date = explode("_", date("H_i_j_n_O_P_s_w_Y", ts));
var tmpArrlh2o = this->gregorian_to_jalali(date[8], date[3], date[2]);
let j_y = array_shift(tmpArrlh2o);
let j_m = array_shift(tmpArrlh2o);
let j_d = array_shift(tmpArrlh2o);
let doy = (j_m < 7) ? ((j_m - 1) * 31) + j_d - 1 : ((j_m - 7) * 30) + j_d + 185;
let kab = ((((j_y + 12) % 33) % 4) == 1) ? 1 : 0;
let sl = strlen(format);
let out = "";
let i = 0;
while (i < sl) {
let sub = substr(format, i, 1);
if (sub == "\\") {
var kos=i+1;
let out .= substr(format, kos, 1);
continue;
}
switch (sub) {
case "E":
case "R":
case "x":
case "X":
let out .= "http://jdf.scr.ir";
break;
case "B":
case "e":
case "g":
case "G":
case "h":
case "I":
case "T":
case "u":
case "Z":
let out .= date(sub, ts);
break;
case "a":
let out .= (date[0] < 12) ? "ق.ظ" : "ب.ظ";
break;
case "A":
let out .= (date[0] < 12) ? "قبل از ظهر" : "بعد از ظهر";
break;
case "b":
let out .= (int) (j_m / 3.1) + 1;
break;
case "c":
let out .= j_y . "/" . j_m . "/" . j_d . " ،" . date[0] . ":" . date[1] . ":" . date[6] . " " . date[5];
break;
case "C":
let out .= (int) ((j_y + 99) / 100);
break;
case "d":
let out .= (j_d < 10) ? "0" . j_d : j_d;
break;
case "D":
let out .= jdate_words(["kh" : date[7]], " ");
break;
case "f":
let out .= jdate_words(["ff" : j_m], " ");
break;
case "F":
let out .= jdate_words(["mm" : j_m], " ");
break;
case "H":
let out .= date[0];
break;
case "i":
let out .= date[1];
break;
case "j":
let out .= j_d;
break;
case "J":
let out .= jdate_words(["rr" : j_d], " ");
break;
case "k":
let out .= this->tr_num(100 - (int) (doy / (kab + 365.24) * 1000) / 10, tr_nums);
break;
case "K":
let out .= this->tr_num((int) (doy / (kab + 365.24) * 1000) / 10, tr_nums);
break;
case "l":
let out .= jdate_words(["rh" : date[7]], " ");
break;
case "L":
let out .= kab;
break;
case "m":
let out .= (j_m > 9) ? j_m : "0" . j_m;
break;
case "M":
let out .= jdate_words(["km" : j_m], " ");
break;
case "n":
let out .= j_m;
break;
case "N":
let out .= date[7] + 1;
break;
case "o":
let jdw = (date[7] == 6) ? 0 : date[7] + 1;
let dny = 364 + kab - doy;
let out .= (jdw > (doy + 3) && doy < 3) ? j_y - 1 : (((3 - dny) > jdw && dny < 3) ? j_y + 1 : j_y);
break;
case "O":
let out .= date[4];
break;
case "p":
let out .= jdate_words(["mb" : j_m], " ");
break;
case "P":
let out .= date[5];
break;
case "q":
let out .= jdate_words(["sh" : j_y], " ");
break;
case "Q":
let out .= kab + 364 - doy;
break;
case "r":
let key = jdate_words(["rh" : date[7], "mm" : j_m]);
let out .= date[0] . ":" . date[1] . ":" . date[6] . " " . date[4] . " " . key["rh"] . "، " . j_d . " " . key["mm"] . " " . j_y;
break;
case "s":
let out .= date[6];
break;
case "S":
let out .= "ام";
break;
case "t":
let out .= (j_m != 12) ? (31 - (int) (j_m / 6.5)) : (kab + 29);
break;
case "U":
let out .= ts;
break;
case "v":
let out .= jdate_words(["ss" : (j_y % 100)], " ");
break;
case "V":
let out .= jdate_words(["ss" : j_y], " ");
break;
case "w":
let out .= (date[7] == 6) ? 0 : date[7] + 1;
break;
case "W":
let avs = ((date[7] == 6) ? 0 : date[7] + 1) - (doy % 7);
if ($avs < 0)
{
let avs += 7;
}
let num = (int) ((doy + avs) / 7);
if (avs < 4) {
let num++;
} elseif (num < 1) {
let num = (avs == 4 || avs == (((((j_y % 33) % 4) - 2) == ((int) ((j_y % 33) * 0.05))) ? 5 : 4)) ? 53 : 52;
}
let aks = avs + kab;
let aks = 0;
if (aks == 7) {
let aks =0;
}
let out .= ((kab + 363 - doy) < aks && aks < 3) ? "01" : ((num < 10) ? "0" . num : num);
break;
case "y":
let out .= substr(j_y, 2, 2);
break;
case "Y":
let out .= j_y;
break;
case "z":
let out .= doy;
break;
default:
let out .= sub;
}
let i=i+1;
}
return (tr_nums != "en") ? this->tr_num(out, "fa", ".") : out;
}
public function jstrftime( var format, var timestamp = "", var none = "", var time_zone = "Asia/Tehran", var tr_nums = "fa") {
var T_sec, ts, date, j_y, j_m, j_d, doy, kab, sl, out, i, sub, avs, num, aks, tmp, jdw, dny, key;
let T_sec = 0;
if (time_zone != "local")
{
date_default_timezone_set((time_zone === "") ? "Asia/Tehran" : time_zone);
}
let ts = T_sec + ((timestamp === "") ? time() : this->tr_num(timestamp));
let date = explode("_", date("h_H_i_j_n_s_w_Y", ts));
var tmpArri5xs = this->gregorian_to_jalali(date[7], date[4], date[3]);
let j_y = array_shift(tmpArri5xs);
let j_m = array_shift(tmpArri5xs);
let j_d = array_shift(tmpArri5xs);
let doy = (j_m < 7) ? ((j_m - 1) * 31) + j_d - 1 : ((j_m - 7) * 30) + j_d + 185;
let kab = ((((j_y + 12) % 33) % 4) == 1) ? 1 : 0;
let sl = strlen(format);
let out = "";
let i = 0;
while (i < sl) {
let sub = substr(format, i, 1);
if (sub == "%") {
let kos=i+1;
let sub = substr(format, kos, 1);
} else {
let out .= sub;
continue;
}
switch (sub) {
case "a":
let out .= jdate_words(["kh" : date[6]], " ");
break;
case "A":
let out .= jdate_words(["rh" : date[6]], " ");
break;
case "d":
let out .= (j_d < 10) ? "0" . j_d : j_d;
break;
case "e":
let out .= (j_d < 10) ? " " . j_d : j_d;
break;
case "j":
let out .= str_pad(doy + 1, 3, 0, STR_PAD_LEFT);
break;
case "u":
let out .= date[6] + 1;
break;
case "w":
let out .= (date[6] == 6) ? 0 : date[6] + 1;
break;
case "U":
let avs = ((date[6] < 5) ? date[6] + 2 : date[6] - 5) - (doy % 7);
if (avs < 0) {
let avs +=7;
}
let num = (int) ((doy + avs) / 7) + 1;
if (avs > 3 || avs == 1) {
let num-=1;
}
let out .= (num < 10) ? "0" . num : num;
break;
case "V":
let avs = ((date[6] == 6) ? 0 : date[6] + 1) - (doy % 7);
if (avs < 0) {
let avs += 7;
}
let num = (int)((doy + avs) / 7);
if (avs < 4) {
let num+=1;
} elseif (num < 1) {
let num = (avs == 4 || avs == (((((j_y % 33) % 4) - 2) == ((int) ((j_y % 33) * 0.05))) ? 5 : 4)) ? 53 : 52;
}
let aks = avs + kab;
if (aks == 7) { let aks = 0;}
let out .= ((kab + 363 - doy) < aks && aks < 3) ? "01" : ((num < 10) ? "0" . num : num);
break;
case "W":
let avs = ((date[6] == 6) ? 0 : date[6] + 1) - (doy % 7);
if (avs < 0) {
let avs += 7;
}
let num = (int) ((doy + avs) / 7) + 1;
if (avs > 3){
let num-=1;
}
let out .= (num < 10) ? "0" . num : num;
break;
case "b":
case "h":
let out .= jdate_words(["km" : j_m], " ");
break;
case "B":
let out .= jdate_words(["mm" : j_m], " ");
break;
case "m":
let out .= (j_m > 9) ? j_m : "0" . j_m;
break;
case "C":
let tmp = (int) (j_y / 100);
let out .= (tmp > 9) ? tmp : "0" . tmp;
break;
case "g":
let jdw = (date[6] == 6) ? 0 : date[6] + 1;
let dny = 364 + kab - doy;
let out .= substr((jdw > (doy + 3) && doy < 3) ? j_y - 1 : (((3 - dny) > jdw && dny < 3) ? j_y + 1 : j_y), 2, 2);
break;
case "G":
let jdw = (date[6] == 6) ? 0 : date[6] + 1;
let dny = 364 + kab - doy;
let out .= (jdw > (doy + 3) && doy < 3) ? j_y - 1 : (((3 - dny) > jdw && dny < 3) ? j_y + 1 : j_y);
break;
case "y":
let out .= substr(j_y, 2, 2);
break;
case "Y":
let out .= j_y;
break;
case "H":
let out .= date[1];
break;
case "I":
let out .= date[0];
break;
case "l":
let out .= (date[0] > 9) ? date[0] : " " . (int) date[0];
break;
case "M":
let out .= date[2];
break;
case "p":
let out .= (date[1] < 12) ? "قبل از ظهر" : "بعد از ظهر";
break;
case "P":
let out .= (date[1] < 12) ? "ق.ظ" : "ب.ظ";
break;
case "r":
let out .= date[0] . ":" . date[2] . ":" . date[5] . " " . ((date[1] < 12) ? "قبل از ظهر" : "بعد از ظهر");
break;
case "R":
let out .= date[1] . ":" . date[2];
break;
case "S":
let out .= date[5];
break;
case "T":
let out .= date[1] . ":" . date[2] . ":" . date[5];
break;
case "X":
let out .= date[0] . ":" . date[2] . ":" . date[5];
break;
case "z":
let out .= date("O", ts);
break;
case "Z":
let out .= date("T", ts);
break;
case "c":
let key = jdate_words(["rh" : date[6], "mm" : j_m]);
let out .= date[1] . ":" . date[2] . ":" . date[5] . " " . date("P", ts) . " " . key["rh"] . "، " . j_d . " " . key["mm"] . " " . j_y;
break;
case "D":
let out .= substr(j_y, 2, 2) . "/" . ((j_m > 9) ? j_m : "0" . j_m) . "/" . ((j_d < 10) ? "0" . j_d : j_d);
break;
case "F":
let out .= j_y . "-" . ((j_m > 9) ? j_m : "0" . j_m) . "-" . ((j_d < 10) ? "0" . j_d : j_d);
break;
case "s":
let out .= ts;
break;
case "x":
let out .= substr(j_y, 2, 2) . "/" . ((j_m > 9) ? j_m : "0" . j_m) . "/" . ((j_d < 10) ? "0" . j_d : j_d);
break;
case "n":
let out .= "\n";
break;
case "t":
let out .= "\t";
break;
case "%":
let out .= "%";
break;
default:
let out .= sub;
}
let i+=1;
}
return (tr_nums != "en") ? this->tr_num(out, "fa", ".") : out;
}
public function jmktime( var h = "", var m = "", var s = "", var jm = "", var jd = "", var jy = "", var none = "", var timezone = "Asia/Tehran") {
var jdate, gy, gm, gd;
if (timezone != "local") {date_default_timezone_set(timezone);}
if (h === "") {
return time();
} else {
var tmpArrrf63 = explode("_", this->tr_num(h . "_" . m . "_" . s . "_" . jm . "_" . jd . "_" . jy));
let h = array_shift(tmpArrrf63);
let m = array_shift(tmpArrrf63);
let s = array_shift(tmpArrrf63);
let jm = array_shift(tmpArrrf63);
let jd = array_shift(tmpArrrf63);
let jy = array_shift(tmpArrrf63);
if (m === "") {
return mktime(h);
} else {
if (s === "") {
return mktime(h, m);
} else {
if (jm === "") {
return mktime(h, m, s);
} else {
let jdate = explode("_", jdate("Y_j", "", "", timezone, "en"));
if (jd === "") {
var tmpArrfog2 = jalali_to_gregorian(jdate[0], jm, jdate[1]);
let gy = array_shift(tmpArrfog2);
let gm = array_shift(tmpArrfog2);
let gd = array_shift(tmpArrfog2);
return mktime(h, m, s, gm);
} else {
if (jy === "") {
var tmpArr16mx = jalali_to_gregorian(jdate[0], jm, jd);
let gy = array_shift(tmpArr16mx);
let gm = array_shift(tmpArr16mx);
let gd = array_shift(tmpArr16mx);
return mktime(h, m, s, gm, gd);
} else {
var tmpArrwtl6 = jalali_to_gregorian(jy, jm, jd);
let gy = array_shift(tmpArrwtl6);
let gm = array_shift(tmpArrwtl6);
let gd = array_shift(tmpArrwtl6);
return mktime(h, m, s, gm, gd, gy);
}
}
}
}
}
}
}
public function jgetdate( var timestamp = "", var none = "", var timezone = "Asia/Tehran", var tn = "en") {
var ts, jdate;
let ts = (timestamp === "") ? time() : this->tr_num(timestamp);
let jdate = explode("_", jdate("F_G_i_j_l_n_s_w_Y_z", ts, "", timezone, tn));
return [
"seconds" : this->tr_num((int) this->tr_num(jdate[6]), tn),
"minutes" : this->tr_num((int) this->tr_num(jdate[2]), tn),
"hours" : jdate[1],
"mday" : jdate[3],
"wday" : jdate[7],
"mon" : jdate[5],
"year" : jdate[8],
"yday" : jdate[9],
"weekday" : jdate[4],
"month" : jdate[0],
0 : this->tr_num(ts, tn)
];
}
public function jcheckdate( var jm, var jd, var jy) {
var l_d;
var tmpArr6fpz = explode("_", this->tr_num(jm . "_" . jd . "_" . jy));
let jm = array_shift(tmpArr6fpz);
let jd = array_shift(tmpArr6fpz);
let jy = array_shift(tmpArr6fpz);
let l_d = (jm == 12 && (((jy + 12) % 33) % 4) != 1) ? 29 : (31 - (int) (jm / 6.5));
return (jm > 12 || jd > l_d || jm < 1 || jd < 1 || jy < 1) ? false : true;
}
public function tr_num( var str, var mod = "en", var mf = "٫") {
var num_a, key_a;
let num_a = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "."];
let key_a = ["۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹", mf];
return (mod == "fa") ? str_replace(num_a, key_a, str) : str_replace(key_a, num_a, str);
}
public function jdate_words( var x_array, var mod = "") {
var x_type, num, sl, xy3, h3, h34, h4, p34, k34, xy4, k3, k4, key;
for x_type,num in x_array {
let num = (int) this->tr_num(num);
switch (x_type) {
case "ss":
let sl = strlen(num);
let xy3 = substr(num, 2 - sl, 1);
let h3 ="";
let h34 = "";
let h4 = "";
if (xy3 == 1) {
let p34 = "";
let k34 = ["ده", "یازده", "دوازده", "سیزده", "چهارده", "پانزده", "شانزده", "هفده", "هجده", "نوزده"];
let h34 = k34[substr(num, 2 - sl, 2) - 10];
} else {
let xy4 = substr(num, 3 - sl, 1);
let p34 = (xy3 == 0 || xy4 == 0) ? "" : " و ";
let k3 = ["", "", "بیست", "سی", "چهل", "پنجاه", "شصت", "هفتاد", "هشتاد", "نود"];
let h3 = k3[xy3];
let k4 = ["", "یک", "دو", "سه", "چهار", "پنج", "شش", "هفت", "هشت", "نه"];
let h4 = k4[xy4];
}
let x_array[x_type] = ((num > 99) ? str_replace(
["12", "13", "14", "19", "20"],
["هزار و دویست", "هزار و سیصد", "هزار و چهارصد", "هزار و نهصد", "دوهزار"],
substr(num, 0, 2)
) . ((substr(num, 2, 2) == "00") ? "" : " و ") : "") . h3 . p34 . h34 . h4;
break;
case "mm":
let key = ["فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند"];
let x_array[x_type] = key[num - 1];
break;
case "rr":
let key = [
"یک", "دو", "سه", "چهار", "پنج", "شش", "هفت", "هشت", "نه", "ده", "یازده", "دوازده", "سیزده", "چهارده", "پانزده", "شانزده", "هفده", "هجده", "نوزده", "بیست", "بیست و یک", "بیست و دو", "بیست و سه", "بیست و چهار", "بیست و پنج", "بیست و شش", "بیست و هفت", "بیست و هشت", "بیست و نه", "سی", "سی و یک"
];
let x_array[x_type] = key[num - 1];
break;
case "rh":
let key = ["یکشنبه", "دوشنبه", "سه شنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه"];
let x_array[x_type] = key[num];
break;
case "sh":
let key = ["مار", "اسب", "گوسفند", "میمون", "مرغ", "سگ", "خوک", "موش", "گاو", "پلنگ", "خرگوش", "نهنگ"];
let x_array[x_type] = key[num % 12];
break;
case "mb":
let key = ["حمل", "ثور", "جوزا", "سرطان", "اسد", "سنبله", "میزان", "عقرب", "قوس", "جدی", "دلو", "حوت"];
let x_array[x_type] = key[num - 1];
break;
case "ff":
let key = ["بهار", "تابستان", "پاییز", "زمستان"];
let x_array[x_type] = key[(int) (num / 3.1)];
break;
case "km":
let key = ["فر", "ار", "خر", "تی", "مر", "شه", "مه", "آب", "آذ", "دی", "به", "اس"];
let x_array[x_type] = key[num - 1];
break;
case "kh":
let key = ["ی", "د", "س", "چ", "پ", "ج", "ش"];
let x_array[x_type] = key[num];
break;
default:
let x_array[x_type] = num;
}
}
return (mod === "") ? x_array : implode(mod, x_array);
}
public function gregorian_to_jalali( var gy, var gm, var gd, var mod = "") {
var g_d_m, gy2, days, jy, jm, jd;
var tmpArrcxet = explode("_", this->tr_num(gy . "_" . gm . "_" . gd));
let gy = array_shift(tmpArrcxet);
let gm = array_shift(tmpArrcxet);
let gd = array_shift(tmpArrcxet);
let g_d_m = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
let gy2 = (gm > 2) ? (gy + 1) : gy;
let days = 355666 + (365 * gy) + ((int) ((gy2 + 3) / 4)) - ((int) ((gy2 + 99) / 100)) + ((int) ((gy2 + 399) / 400)) + gd + g_d_m[gm - 1];
let jy = -1595 + (33 * ((int) (days / 12053)));
let days %= 12053;
let jy += 4 * ((int) (days / 1461));
let days %= 1461;
if (days > 365) {
let jy += (int) ((days - 1) / 365);
let days = (days - 1) % 365;
}
if (days < 186) {
let jm = 1 + (int) (days / 31);
let jd = 1 + (days % 31);
} else {
let jm = 7 + (int) ((days - 186) / 30);
let jd = 1 + ((days - 186) % 30);
}
return (mod == "") ? [jy, jm, jd] : jy . mod . jm . mod . jd;
}
public function jalali_to_gregorian( var jy, var jm, var jd, var mod = "") {
var days, gy, gd, sal_a, gm;
var tmpArro3cr = explode("_", this->tr_num(jy . "_" . jm . "_" . jd));
let jy = array_shift(tmpArro3cr);
let jm = array_shift(tmpArro3cr);
let jd = array_shift(tmpArro3cr);
let jy += 1595;
let days = -355668 + (365 * jy) + (((int) (jy / 33)) * 8) + ((int) (((jy % 33) + 3) / 4)) + jd + ((jm < 7) ? (jm - 1) * 31 : ((jm - 7) * 30) + 186);
let gy = 400 * ((int)(days / 146097));
let days %= 146097;
if (days > 36524) {
let koss=days - 1;
let gy += 100 * ((int)(koss / 36524));
let days %= 36524;
let kosss=days+1;
if (days >= 365)
{
let days=kosss;
}
}
let gy += 4 * ((int) (days / 1461));
let days %= 1461;
if (days > 365) {
let gy += (int) ((days - 1) / 365);
let days = (days - 1) % 365;
}
let gd = days + 1;
let sal_a = [0, 31, ((gy % 4 == 0 && gy % 100 != 0) || (gy % 400 == 0)) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
let gm = 0;
while (gm < 13 && gd > sal_a[gm]) {
return (mod == "") ? [gy, gm, gd] : gy . mod . gm . mod . gd;
}
}
}
bug