اعمال تابع قديمي در توابع تغيير يافته php

Artas

Member
قديم در تابع زير :

کد:
		// Short representation of month in format
		if ((strpos($format, '\M') === false && strpos($format, 'M') !== false) || (strpos($format, '\r') === false && strpos($format, 'r') !== false))
		{
			$lang_dates['May'] = $lang_dates['May_short'];
		}

		unset($lang_dates['May_short']);

		if (!$midnight)
		{
			list($d, $m, $y) = explode(' ', gmdate('j n Y', time() + $this->timezone + $this->dst));
			$midnight = gmmktime(0, 0, 0, $m, $d, $y) - $this->timezone - $this->dst;
		}

		if (strpos($format, '|') === false || ($gmepoch < $midnight - 86400 && !$forcedate) || ($gmepoch > $midnight + 172800 && !$forcedate))
		{
			return strtr(@gmdate(str_replace('|', '', $format), $gmepoch + $this->timezone + $this->dst), $lang_dates);
		}

		if ($gmepoch > $midnight + 86400 && !$forcedate)
		{
			$format = substr($format, 0, strpos($format, '|')) . '||' . substr(strrchr($format, '|'), 1);
			return str_replace('||', $this->lang['datetime']['TOMORROW'], strtr(@gmdate($format, $gmepoch + $this->timezone + $this->dst), $lang_dates));
		}
		else if ($gmepoch > $midnight && !$forcedate)
		{
			$format = substr($format, 0, strpos($format, '|')) . '||' . substr(strrchr($format, '|'), 1);
			return str_replace('||', $this->lang['datetime']['TODAY'], strtr(@gmdate($format, $gmepoch + $this->timezone + $this->dst), $lang_dates));
		}
		else if ($gmepoch > $midnight - 86400 && !$forcedate)
		{
			$format = substr($format, 0, strpos($format, '|')) . '||' . substr(strrchr($format, '|'), 1);
			return str_replace('||', $this->lang['datetime']['YESTERDAY'], strtr(@gmdate($format, $gmepoch + $this->timezone + $this->dst), $lang_dates));
		}

		return strtr(@gmdate(str_replace('|', '', $format), $gmepoch + $this->timezone + $this->dst), $lang_dates);
	}

رشته زير را مي يافتيم :

کد:
if (strpos($format, '|') === false || ($gmepoch < $midnight - 86400 && !$forcedate) || ($gmepoch > $midnight + 172800 && !$forcedate))
  {
    return strtr(@gmdate(str_replace('|', '', $format), $gmepoch + $this->timezone + $this->dst), $lang_dates);
  }

و رشته زير را جايگزينش مي كرديم :

کد:
if (strpos($format, '|') === false || ($gmepoch < $midnight - 86400 && !$forcedate) || ($gmepoch > $midnight + 172800 && !$forcedate))
      {
         $myformata = array('Y m d', ', g:i a', 'D ');
         $firststep = @gmdate(str_replace('|', '', $myformata[0]), $gmepoch);
         $secstep = explode(" ", $firststep);
         require_once ('jalali.php');
         list( $jy, $jm, $jd ) = gregorian_to_jalali($secstep[0], $secstep[1], $secstep[2]);
         return strtr(@gmdate(str_replace('|', '', $myformata[2]), $gmepoch + $this->timezone + $this->dst), $lang_dates).
         $jd . ' ' . givemonth($jm) . ' ' . $jy.
         strtr(@gmdate(str_replace('|', '', $myformata[1]), $gmepoch + $this->timezone + $this->dst), $lang_dates);
      }


تا تاريخ شمسي شود.



الان تابع اولي كه گفتم بصورت زير تغيير كرده :


کد:
			// Short representation of month in format? Some languages use different terms for the long and short format of May
			if ((strpos($format, '\M') === false && strpos($format, 'M') !== false) || (strpos($format, '\r') === false && strpos($format, 'r') !== false))
			{
				$date_cache[$format]['lang']['May'] = $this->lang['datetime']['May_short'];
			}
		}

		// Show date <= 1 hour ago as 'xx min ago'
		// A small tolerence is given for times in the future and times in the future but in the same minute are displayed as '< than a minute ago'
		if ($delta <= 3600 && ($delta >= -5 || (($now / 60) % 60) == (($gmepoch / 60) % 60)) && $date_cache[$format]['is_short'] !== false && !$forcedate && isset($this->lang['datetime']['AGO']))
		{
			return $this->lang(array('datetime', 'AGO'), max(0, (int) floor($delta / 60)));
		}

		if (!$midnight)
		{
			list($d, $m, $y) = explode(' ', gmdate('j n Y', time() + $date_cache[$format]['zone_offset']));
			$midnight = gmmktime(0, 0, 0, $m, $d, $y) - $date_cache[$format]['zone_offset'];
		}

		if ($date_cache[$format]['is_short'] !== false && !$forcedate)
		{
			$day = false;

			if ($gmepoch > $midnight + 86400)
			{
				$day = 'TOMORROW';
			}
			else if ($gmepoch > $midnight)
			{
				$day = 'TODAY';
			}
			else if ($gmepoch > $midnight - 86400)
			{
				$day = 'YESTERDAY';
			}

			if ($day !== false)
			{
				return str_replace('||', $this->lang['datetime'][$day], strtr(@gmdate($date_cache[$format]['format_short'], $gmepoch + $date_cache[$format]['zone_offset']), $date_cache[$format]['lang']));
			}
		}

		return strtr(@gmdate($date_cache[$format]['format_long'], $gmepoch + $date_cache[$format]['zone_offset']), $date_cache[$format]['lang']);
	}



بايد چه كار كنيم ؟ :shock:
 

Omid PLUS

Member
این کد رو پیدا کن:
PHP:
return strtr(@gmdate($date_cache[$format]['format_long'], $gmepoch + $date_cache[$format]['zone_offset']), $date_cache[$format]['lang']);
این کد رو بجاش قرار بدی احتمالاً مشکلت حل میشه:rose:
PHP:
$myformata = array('Y m d', ', g:i a', 'D ');
$firststep = @gmdate($myformata[0], $gmepoch);
$secstep = explode(" ", $firststep);
require_once ('jalali.php');
list( $jy, $jm, $jd ) = gregorian_to_jalali($secstep[0], $secstep[1], $secstep[2]);
return strtr(@gmdate($myformata[2], $gmepoch + $date_cache[$format]['zone_offset']), $date_cache[$format]['lang']).
$jd . ' ' . givemonth($jm) . ' ' . $jy.
strtr(@gmdate($myformata[1], $gmepoch + $date_cache[$format]['zone_offset']), $date_cache[$format]['lang']);
 

جدیدترین ارسال ها

بالا