Parsi Date - Version 1.3.4

Version Description

  • unix timstamp problems fixed
  • languages fixed
  • core functions improved
Download this release

Release Info

Developer man4toman
Plugin Icon Parsi Date
Version 1.3.4
Comparing to
See all releases

Code changes from version 1.3.3 to 1.3.4

Files changed (3) hide show
  1. lib/parsidate.php +5 -15
  2. readme.txt +7 -2
  3. wp-parsidate.php +1 -1
lib/parsidate.php CHANGED
@@ -64,27 +64,21 @@ class bn_parsidate
64
  $dayofyear=$this->g_days_sum_month[$gm]+$gd;
65
  $leap=self::IsLeapYear($gy-1);
66
  $leab=self::IsLeapYear($gy);
67
- if($leap and $gm>2)
68
- ++$gd;
69
  if($dayofyear>79)
70
  {
71
  $jd=($leab)?$dayofyear-78:$dayofyear-79;
72
  $jy=$gy-621;
73
- for($i=0;$jd>$this->j_days_in_month[$i];$i++)
74
- $jd-=$this->j_days_in_month[$i];
75
  }
76
  else
77
  {
78
  $jd=($leap||($leab&&$gm>2))?287+$dayofyear:286+$dayofyear;
79
- $jy=$gy-622;
80
- if($jd==366)
81
- return array($jy,12,30);
82
- for($i=0;$jd>$this->j_days_in_month[$i];$i++)
83
- $jd-=$this->j_days_in_month[$i];
84
  }
 
 
85
  $jm=++$i;
86
  return array($jy,$jm,$jd);
87
- }
88
 
89
  public function trim_number($num,$sp='٫')
90
  {
@@ -97,11 +91,7 @@ class bn_parsidate
97
  public function persian_date($format,$date='now',$lang='per')
98
  {
99
  $j_days_in_month = array(31, 62, 93, 124, 155, 186, 216, 246, 276, 306, 336, 365);
100
- if(strtotime($date)){
101
- $timestamp=strtotime($date);
102
- }else{
103
- $timestamp = $date ;
104
- }
105
 
106
  $date=getdate($timestamp);
107
  list($date['year'],$date['mon'],$date['mday'])=self::gregorian_to_persian($date['year'],$date['mon'],$date['mday']);
64
  $dayofyear=$this->g_days_sum_month[$gm]+$gd;
65
  $leap=self::IsLeapYear($gy-1);
66
  $leab=self::IsLeapYear($gy);
 
 
67
  if($dayofyear>79)
68
  {
69
  $jd=($leab)?$dayofyear-78:$dayofyear-79;
70
  $jy=$gy-621;
 
 
71
  }
72
  else
73
  {
74
  $jd=($leap||($leab&&$gm>2))?287+$dayofyear:286+$dayofyear;
75
+ $jy=$gy-622;
 
 
 
 
76
  }
77
+ for($i=0;$i<11 and $jd>$this->j_days_in_month[$i];$i++)
78
+ $jd-=$this->j_days_in_month[$i];
79
  $jm=++$i;
80
  return array($jy,$jm,$jd);
81
+ }
82
 
83
  public function trim_number($num,$sp='٫')
84
  {
91
  public function persian_date($format,$date='now',$lang='per')
92
  {
93
  $j_days_in_month = array(31, 62, 93, 124, 155, 186, 216, 246, 276, 306, 336, 365);
94
+ $timestamp = is_numeric($date) && (int)$date == $date?$date:strtotime($date);
 
 
 
 
95
 
96
  $date=getdate($timestamp);
97
  list($date['year'],$date['mon'],$date['mday'])=self::gregorian_to_persian($date['year'],$date['mon'],$date['mday']);
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: lord_viper, man4toman
3
  Donate link: http://forum.wp-parsi.com/
4
  Tags: shamsi, wp-parsi, wpparsi, persian, parsi, farsi, jalali, date, calendar, i18n, l10n, Iran, Iranian, parsidate, rtl
5
  Requires at least: 3.6
6
- Tested up to: 3.9
7
- Stable tag: 1.3.3
8
 
9
  Persian package builder for WordPress, Full RTL and Shamsi(Jalali) date
10
 
@@ -38,6 +38,11 @@ List of some features:
38
  2. Widget of 'بایگانی تاریخ خورشیدی'
39
 
40
  == Changelog ==
 
 
 
 
 
41
  = 1.3.3 =
42
  * editor problems fixed
43
 
3
  Donate link: http://forum.wp-parsi.com/
4
  Tags: shamsi, wp-parsi, wpparsi, persian, parsi, farsi, jalali, date, calendar, i18n, l10n, Iran, Iranian, parsidate, rtl
5
  Requires at least: 3.6
6
+ Tested up to: 3.9.1
7
+ Stable tag: 1.3.4
8
 
9
  Persian package builder for WordPress, Full RTL and Shamsi(Jalali) date
10
 
38
  2. Widget of 'بایگانی تاریخ خورشیدی'
39
 
40
  == Changelog ==
41
+ = 1.3.4 =
42
+ * unix timstamp problems fixed
43
+ * languages fixed
44
+ * core functions improved
45
+
46
  = 1.3.3 =
47
  * editor problems fixed
48
 
wp-parsidate.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /*
4
  Plugin Name: WP-Parsidate
5
- Version: 1.3.3
6
  Author: Mobin Ghasempoor
7
  Author URI: http://wp-parsi.com/
8
  Plugin URI: http://forum.wp-parsi.com/
2
 
3
  /*
4
  Plugin Name: WP-Parsidate
5
+ Version: 1.3.4
6
  Author: Mobin Ghasempoor
7
  Author URI: http://wp-parsi.com/
8
  Plugin URI: http://forum.wp-parsi.com/