Plugin Directory

Changeset 3103095


Ignore:
Timestamp:
06/15/2024 12:53:37 PM (22 months ago)
Author:
addonspress
Message:

2.0.7

Location:
nepali-date-converter
Files:
27 added
3 edited

Legend:

Unmodified
Added
Removed
  • nepali-date-converter/trunk/inc/frameworks/nepali-calendar/nepali_calendar.php

    r2322536 r3103095  
    88
    99Day of Month
    10 d   Numeric, with leading zeros     01–31
    11 j   Numeric, without leading zeros  1–31
    12 S   The English suffix for the day of the month     st, nd or th in the 1st, 2nd or 15th.//This is not supported
     10d   Numeric, with leading zeros     01–31
     11j   Numeric, without leading zeros  1–31
     12S   The English suffix for the day of the month     st, nd or th in the 1st, 2nd or 15th.//This is not supported
    1313
    1414Weekday
    15 l   Full name  (lowercase 'L')  Sunday – Saturday
    16 D   Three letter name   Mon – Sun
     15l   Full name  (lowercase 'L')  Sunday – Saturday
     16D   Three letter name   Mon – Sun
    1717
    1818Month
    19 m   Numeric, with leading zeros     01–12
    20 n   Numeric, without leading zeros  1–12
    21 F   Textual full    January – December
    22 M   Textual three letters   Jan - Dec
     19m   Numeric, with leading zeros     01–12
     20n   Numeric, without leading zeros  1–12
     21F   Textual full    January – December
     22M   Textual three letters   Jan - Dec
    2323
    2424Year
    25 Y   Numeric, 4 digits   Eg., 1999, 2003
    26 y   Numeric, 2 digits   Eg., 99, 03
     25Y   Numeric, 4 digits   Eg., 1999, 2003
     26y   Numeric, 2 digits   Eg., 99, 03
    2727
    2828*/
    2929
    30 if ( ! class_exists( 'NDC_Nepali_Calendar' ) ){
     30if ( ! class_exists( 'NDC_Nepali_Calendar' ) ) {
    3131    class NDC_Nepali_Calendar {
    3232        /*added*/
     
    3737         * @access public
    3838         * @since 1.0
    39          *
    40          */
    41         public $eng_nep_num = array(
    42             '0'=>'०',
    43             '1'=>'१',
    44             '2'=>'२',
    45             '3'=>'३',
    46             '4'=>'४',
    47             '5'=>'५',
    48             '6'=>'६',
    49             '7'=>'७',
    50             '8'=>'८',
    51             '9'=>'९'
     39         */
     40        public $eng_nep_num = array(
     41            '0' => '०',
     42            '1' => '१',
     43            '2' => '२',
     44            '3' => '३',
     45            '4' => '४',
     46            '5' => '५',
     47            '6' => '६',
     48            '7' => '७',
     49            '8' => '८',
     50            '9' => '९',
    5251        );
    5352
     
    5857         * @access public
    5958         * @since 1.0
    60          *
    6159         */
    6260        public $long_eng_nep_mth = array(
    63             "January" => 'बैशाख',
    64             "February" => 'जेष्ठ',
    65             "March" => 'असार',
    66             "April" => 'साउन',
    67             "May" => 'भदौ',
    68             "June" => 'अशोज',
    69             "July" => 'कार्तिक',
    70             "August" => 'मंसिर',
    71             "September" => 'पुस',
    72             "October" => 'माघ',
    73             "November" => 'फाल्गुन',
    74             "December"=> 'चैत्र'
     61            'January'  => 'बैशाख',
     62            'February' => 'जेष्ठ',
     63            'March'    => 'असार',
     64            'April'    => 'साउन',
     65            'May'      => 'भदौ',
     66            'June'      => 'अशोज',
     67            'July'      => 'कार्तिक',
     68            'August'    => 'मंसिर',
     69            'September' => 'पुस',
     70            'October'  => 'माघ',
     71            'November' => 'फाल्गुन',
     72            'December'  => 'चैत्र',
    7573        );
    7674
     
    8179         * @access public
    8280         * @since 1.0
    83          *
    8481         */
    8582        public $long_eng_nep_mth_in_eng = array(
    86             "January" => 'Baishakh',
    87             "February" => 'Jestha',
    88             "March" => 'Ashad',
    89             "April" => 'Shrawan',
    90             "May" => 'Bhadra',
    91             "June" => 'Ashwin',
    92             "July" => 'Kartik',
    93             "August" => 'Mangshir',
    94             "September" => 'Poush',
    95             "October" => 'Magh',
    96             "November" => 'Falgun',
    97             "December"=> 'Chaitra'
     83            'January'  => 'Baishakh',
     84            'February' => 'Jestha',
     85            'March'    => 'Ashad',
     86            'April'    => 'Shrawan',
     87            'May'      => 'Bhadra',
     88            'June'      => 'Ashwin',
     89            'July'      => 'Kartik',
     90            'August'    => 'Mangshir',
     91            'September' => 'Poush',
     92            'October'  => 'Magh',
     93            'November' => 'Falgun',
     94            'December'  => 'Chaitra',
    9895        );
    9996
     
    104101         * @access public
    105102         * @since 1.0
    106          *
    107103         */
    108104        public $short_eng_nep_mth = array(
    109             "Jan" => 'बैशाख',
    110             "Feb" => 'जेष्ठ',
    111             "Mar" => 'असार',
    112             "Apr" => 'साउन',
    113             "May" => 'भदौ',
    114             "Jun" => 'अशोज',
    115             "Jul" => 'कार्तिक',
    116             "Aug" => 'मंसिर',
    117             "Sep" => 'पुस',
    118             "Oct" => 'माघ',
    119             "Nov" => 'फाल्गुन',
    120             "Dec" => 'चैत्र'
     105            'Jan' => 'बैशाख',
     106            'Feb' => 'जेष्ठ',
     107            'Mar' => 'असार',
     108            'Apr' => 'साउन',
     109            'May' => 'भदौ',
     110            'Jun' => 'अशोज',
     111            'Jul' => 'कार्तिक',
     112            'Aug' => 'मंसिर',
     113            'Sep' => 'पुस',
     114            'Oct' => 'माघ',
     115            'Nov' => 'फाल्गुन',
     116            'Dec' => 'चैत्र',
    121117        );
    122118
     
    127123         * @access public
    128124         * @since 1.0
    129          *
    130125         */
    131126        public $short_eng_nep_mth_in_eng = array(
    132             "Jan" => 'Baishakh',
    133             "Feb" => 'Jestha',
    134             "Mar" => 'Ashad',
    135             "Apr" => 'Shrawan',
    136             "May" => 'Bhadra',
    137             "Jun" => 'Ashwin',
    138             "Jul" => 'Kartik',
    139             "Aug" => 'Mangshir',
    140             "Sep" => 'Poush',
    141             "Oct" => 'Magh',
    142             "Nov" => 'Falgun',
    143             "Dec"=> 'Chaitra'
     127            'Jan' => 'Baishakh',
     128            'Feb' => 'Jestha',
     129            'Mar' => 'Ashad',
     130            'Apr' => 'Shrawan',
     131            'May' => 'Bhadra',
     132            'Jun' => 'Ashwin',
     133            'Jul' => 'Kartik',
     134            'Aug' => 'Mangshir',
     135            'Sep' => 'Poush',
     136            'Oct' => 'Magh',
     137            'Nov' => 'Falgun',
     138            'Dec' => 'Chaitra',
    144139        );
    145140
     
    150145         * @access public
    151146         * @since 1.0
    152          *
    153147         */
    154148        public $long_eng_nep_day = array(
    155             "Sunday" => 'आइतवार',
    156             "Monday" => 'सोमवार',
    157             "Tuesday" => 'मङ्लबार',
    158             "Wednesday" => 'बुधबार',
    159             "Thursday" => 'बिहिबार',
    160             "Friday" => 'शुक्रबार',
    161             "Saturday"=> 'शनिबार'
     149            'Sunday'    => 'आइतवार',
     150            'Monday'    => 'सोमवार',
     151            'Tuesday'  => 'मङ्लबार',
     152            'Wednesday' => 'बुधबार',
     153            'Thursday' => 'बिहिबार',
     154            'Friday'    => 'शुक्रबार',
     155            'Saturday'  => 'शनिबार',
    162156        );
    163157
     
    168162         * @access public
    169163         * @since 1.0
    170          *
    171164         */
    172165        public $long_eng_nep_day_eng = array(
    173             "Sunday" => 'Aaitabar',
    174             "Monday" => 'Sombar',
    175             "Tuesday" => 'Mangalbar',
    176             "Wednesday" => 'Budhabar',
    177             "Thursday" => 'Bihibar',
    178             "Friday" => 'Sukrabar',
    179             "Saturday"=> 'Sanibar'
     166            'Sunday'    => 'Aaitabar',
     167            'Monday'    => 'Sombar',
     168            'Tuesday'  => 'Mangalbar',
     169            'Wednesday' => 'Budhabar',
     170            'Thursday' => 'Bihibar',
     171            'Friday'    => 'Sukrabar',
     172            'Saturday'  => 'Sanibar',
    180173        );
    181174
     
    186179         * @access public
    187180         * @since 1.0
    188          *
    189181         */
    190182        public $short_eng_nep_day = array(
    191             "Sun" => 'आइत',
    192             "Mon" => 'सोम',
    193             "Tue" => 'मङ्ल',
    194             "Wed" => 'बुध',
    195             "Thu" => 'बिहि',
    196             "Fri" => 'शुक्र',
    197             "Sat"=> 'शनि'
     183            'Sun' => 'आइत',
     184            'Mon' => 'सोम',
     185            'Tue' => 'मङ्ल',
     186            'Wed' => 'बुध',
     187            'Thu' => 'बिहि',
     188            'Fri' => 'शुक्र',
     189            'Sat' => 'शनि',
    198190        );
    199191
     
    204196         * @access public
    205197         * @since 1.0
    206          *
    207198         */
    208199        public $short_eng_nep_day_eng = array(
    209             "Sun" => 'Aaita',
    210             "Mon" => 'Som',
    211             "Tue" => 'Mangal',
    212             "Wed" => 'Budha',
    213             "Thu" => 'Bihi',
    214             "Fri" => 'Sukra',
    215             "Sat"=> 'Sani'
     200            'Sun' => 'Aaita',
     201            'Mon' => 'Som',
     202            'Tue' => 'Mangal',
     203            'Wed' => 'Budha',
     204            'Thu' => 'Bihi',
     205            'Fri' => 'Sukra',
     206            'Sat' => 'Sani',
    216207        );
    217208
    218209        /*Some numeric functions for date format Start=====================*/
    219         private function getTwoCharStr($str){
    220             if(strlen($str) == 0){
     210        private function getTwoCharStr( $str ) {
     211            if ( strlen( $str ) == 0 ) {
    221212                return '00';
    222213            }
    223             if(strlen($str) == 1){
    224                 return '0'.$str;
    225             }
    226             return  $str;
     214            if ( strlen( $str ) == 1 ) {
     215                return '0' . $str;
     216            }
     217            return $str;
    227218        }
    228         private function getNepMonthToNumeric($str){
    229             if(strlen($str) == 0){
     219        private function getNepMonthToNumeric( $str ) {
     220            if ( strlen( $str ) == 0 ) {
    230221                return '00';
    231222            }
    232             if(strlen($str) == 1){
    233                 return '0'.$str;
    234             }
    235             return  $str;
     223            if ( strlen( $str ) == 1 ) {
     224                return '0' . $str;
     225            }
     226            return $str;
    236227        }
    237228        /*Some numeric functions for date format End=====================*/
     
    246237         * @access private
    247238         * @since 1.0
    248          *
    249239         */
    250240        private $_c_bs = array(
    251             0 => array(2000,30,32,31,32,31,30,30,30,29,30,29,31),
    252             1 => array(2001,31,31,32,31,31,31,30,29,30,29,30,30),
    253             2 => array(2002,31,31,32,32,31,30,30,29,30,29,30,30),
    254             3 => array(2003,31,32,31,32,31,30,30,30,29,29,30,31),
    255             4 => array(2004,30,32,31,32,31,30,30,30,29,30,29,31),
    256             5 => array(2005,31,31,32,31,31,31,30,29,30,29,30,30),
    257             6 => array(2006,31,31,32,32,31,30,30,29,30,29,30,30),
    258             7 => array(2007,31,32,31,32,31,30,30,30,29,29,30,31),
    259             8 => array(2008,31,31,31,32,31,31,29,30,30,29,29,31),
    260             9 => array(2009,31,31,32,31,31,31,30,29,30,29,30,30),
    261             10 => array(2010,31,31,32,32,31,30,30,29,30,29,30,30),
    262             11 => array(2011,31,32,31,32,31,30,30,30,29,29,30,31),
    263             12 => array(2012,31,31,31,32,31,31,29,30,30,29,30,30),
    264             13 => array(2013,31,31,32,31,31,31,30,29,30,29,30,30),
    265             14 => array(2014,31,31,32,32,31,30,30,29,30,29,30,30),
    266             15 => array(2015,31,32,31,32,31,30,30,30,29,29,30,31),
    267             16 => array(2016,31,31,31,32,31,31,29,30,30,29,30,30),
    268             17 => array(2017,31,31,32,31,31,31,30,29,30,29,30,30),
    269             18 => array(2018,31,32,31,32,31,30,30,29,30,29,30,30),
    270             19 => array(2019,31,32,31,32,31,30,30,30,29,30,29,31),
    271             20 => array(2020,31,31,31,32,31,31,30,29,30,29,30,30),
    272             21 => array(2021,31,31,32,31,31,31,30,29,30,29,30,30),
    273             22 => array(2022,31,32,31,32,31,30,30,30,29,29,30,30),
    274             23 => array(2023,31,32,31,32,31,30,30,30,29,30,29,31),
    275             24 => array(2024,31,31,31,32,31,31,30,29,30,29,30,30),
    276             25 => array(2025,31,31,32,31,31,31,30,29,30,29,30,30),
    277             26 => array(2026,31,32,31,32,31,30,30,30,29,29,30,31),
    278             27 => array(2027,30,32,31,32,31,30,30,30,29,30,29,31),
    279             28 => array(2028,31,31,32,31,31,31,30,29,30,29,30,30),
    280             29 => array(2029,31,31,32,31,32,30,30,29,30,29,30,30),
    281             30 => array(2030,31,32,31,32,31,30,30,30,29,29,30,31),
    282             31 => array(2031,30,32,31,32,31,30,30,30,29,30,29,31),
    283             32 => array(2032,31,31,32,31,31,31,30,29,30,29,30,30),
    284             33 => array(2033,31,31,32,32,31,30,30,29,30,29,30,30),
    285             34 => array(2034,31,32,31,32,31,30,30,30,29,29,30,31),
    286             35 => array(2035,30,32,31,32,31,31,29,30,30,29,29,31),
    287             36 => array(2036,31,31,32,31,31,31,30,29,30,29,30,30),
    288             37 => array(2037,31,31,32,32,31,30,30,29,30,29,30,30),
    289             38 => array(2038,31,32,31,32,31,30,30,30,29,29,30,31),
    290             39 => array(2039,31,31,31,32,31,31,29,30,30,29,30,30),
    291             40 => array(2040,31,31,32,31,31,31,30,29,30,29,30,30),
    292             41 => array(2041,31,31,32,32,31,30,30,29,30,29,30,30),
    293             42 => array(2042,31,32,31,32,31,30,30,30,29,29,30,31),
    294             43 => array(2043,31,31,31,32,31,31,29,30,30,29,30,30),
    295             44 => array(2044,31,31,32,31,31,31,30,29,30,29,30,30),
    296             45 => array(2045,31,32,31,32,31,30,30,29,30,29,30,30),
    297             46 => array(2046,31,32,31,32,31,30,30,30,29,29,30,31),
    298             47 => array(2047,31,31,31,32,31,31,30,29,30,29,30,30),
    299             48 => array(2048,31,31,32,31,31,31,30,29,30,29,30,30),
    300             49 => array(2049,31,32,31,32,31,30,30,30,29,29,30,30),
    301             50 => array(2050,31,32,31,32,31,30,30,30,29,30,29,31),
    302             51 => array(2051,31,31,31,32,31,31,30,29,30,29,30,30),
    303             52 => array(2052,31,31,32,31,31,31,30,29,30,29,30,30),
    304             53 => array(2053,31,32,31,32,31,30,30,30,29,29,30,30),
    305             54 => array(2054,31,32,31,32,31,30,30,30,29,30,29,31),
    306             55 => array(2055,31,31,32,31,31,31,30,29,30,29,30,30),
    307             56 => array(2056,31,31,32,31,32,30,30,29,30,29,30,30),
    308             57 => array(2057,31,32,31,32,31,30,30,30,29,29,30,31),
    309             58 => array(2058,30,32,31,32,31,30,30,30,29,30,29,31),
    310             59 => array(2059,31,31,32,31,31,31,30,29,30,29,30,30),
    311             60 => array(2060,31,31,32,32,31,30,30,29,30,29,30,30),
    312             61 => array(2061,31,32,31,32,31,30,30,30,29,29,30,31),
    313             62 => array(2062,30,32,31,32,31,31,29,30,29,30,29,31),
    314             63 => array(2063,31,31,32,31,31,31,30,29,30,29,30,30),
    315             64 => array(2064,31,31,32,32,31,30,30,29,30,29,30,30),
    316             65 => array(2065,31,32,31,32,31,30,30,30,29,29,30,31),
    317             66 => array(2066,31,31,31,32,31,31,29,30,30,29,29,31),
    318             67 => array(2067,31,31,32,31,31,31,30,29,30,29,30,30),
    319             68 => array(2068,31,31,32,32,31,30,30,29,30,29,30,30),
    320             69 => array(2069,31,32,31,32,31,30,30,30,29,29,30,31),
    321             70 => array(2070,31,31,31,32,31,31,29,30,30,29,30,30),
    322             71 => array(2071,31,31,32,31,31,31,30,29,30,29,30,30),
    323             72 => array(2072,31,32,31,32,31,30,30,29,30,29,30,30),
    324             73 => array(2073,31,32,31,32,31,30,30,30,29,29,30,31),
    325             74 => array(2074,31,31,31,32,31,31,30,29,30,29,30,30),
    326             75 => array(2075,31,31,32,31,31,31,30,29,30,29,30,30),
    327             76 => array(2076,31,32,31,32,31,30,30,30,29,29,30,30),
    328             77 => array(2077,31,32,31,32,31,30,30,30,29,30,29,31),
    329             78 => array(2078,31,31,31,32,31,31,30,29,30,29,30,30),
    330             79 => array(2079,31,31,32,31,31,31,30,29,30,29,30,30),
    331             80 => array(2080,31,32,31,32,31,30,30,30,29,29,30,30),
    332             81 => array(2081,31,31,32,32,31,30,30,30,29,30,30,30),
    333             82 => array(2082,30,32,31,32,31,30,30,30,29,30,30,30),
    334             83 => array(2083,31,31,32,31,31,30,30,30,29,30,30,30),
    335             84 => array(2084,31,31,32,31,31,30,30,30,29,30,30,30),
    336             85 => array(2085,31,32,31,32,30,31,30,30,29,30,30,30),
    337             86 => array(2086,30,32,31,32,31,30,30,30,29,30,30,30),
    338             87 => array(2087,31,31,32,31,31,31,30,30,29,30,30,30),
    339             88 => array(2088,30,31,32,32,30,31,30,30,29,30,30,30),
    340             89 => array(2089,30,32,31,32,31,30,30,30,29,30,30,30),
    341             90 => array(2090,30,32,31,32,31,30,30,30,29,30,30,30)
     241            0  => array( 2000, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31 ),
     242            1  => array( 2001, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     243            2  => array( 2002, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30 ),
     244            3  => array( 2003, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31 ),
     245            4  => array( 2004, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31 ),
     246            5  => array( 2005, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     247            6  => array( 2006, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30 ),
     248            7  => array( 2007, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31 ),
     249            8  => array( 2008, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31 ),
     250            9  => array( 2009, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     251            10 => array( 2010, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30 ),
     252            11 => array( 2011, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31 ),
     253            12 => array( 2012, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30 ),
     254            13 => array( 2013, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     255            14 => array( 2014, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30 ),
     256            15 => array( 2015, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31 ),
     257            16 => array( 2016, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30 ),
     258            17 => array( 2017, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     259            18 => array( 2018, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30 ),
     260            19 => array( 2019, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31 ),
     261            20 => array( 2020, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30 ),
     262            21 => array( 2021, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     263            22 => array( 2022, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30 ),
     264            23 => array( 2023, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31 ),
     265            24 => array( 2024, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30 ),
     266            25 => array( 2025, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     267            26 => array( 2026, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31 ),
     268            27 => array( 2027, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31 ),
     269            28 => array( 2028, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     270            29 => array( 2029, 31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30 ),
     271            30 => array( 2030, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31 ),
     272            31 => array( 2031, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31 ),
     273            32 => array( 2032, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     274            33 => array( 2033, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30 ),
     275            34 => array( 2034, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31 ),
     276            35 => array( 2035, 30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31 ),
     277            36 => array( 2036, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     278            37 => array( 2037, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30 ),
     279            38 => array( 2038, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31 ),
     280            39 => array( 2039, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30 ),
     281            40 => array( 2040, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     282            41 => array( 2041, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30 ),
     283            42 => array( 2042, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31 ),
     284            43 => array( 2043, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30 ),
     285            44 => array( 2044, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     286            45 => array( 2045, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30 ),
     287            46 => array( 2046, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31 ),
     288            47 => array( 2047, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30 ),
     289            48 => array( 2048, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     290            49 => array( 2049, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30 ),
     291            50 => array( 2050, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31 ),
     292            51 => array( 2051, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30 ),
     293            52 => array( 2052, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     294            53 => array( 2053, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30 ),
     295            54 => array( 2054, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31 ),
     296            55 => array( 2055, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     297            56 => array( 2056, 31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30 ),
     298            57 => array( 2057, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31 ),
     299            58 => array( 2058, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31 ),
     300            59 => array( 2059, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     301            60 => array( 2060, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30 ),
     302            61 => array( 2061, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31 ),
     303            62 => array( 2062, 30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31 ),
     304            63 => array( 2063, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     305            64 => array( 2064, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30 ),
     306            65 => array( 2065, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31 ),
     307            66 => array( 2066, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31 ),
     308            67 => array( 2067, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     309            68 => array( 2068, 31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30 ),
     310            69 => array( 2069, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31 ),
     311            70 => array( 2070, 31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30 ),
     312            71 => array( 2071, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     313            72 => array( 2072, 31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30 ),
     314            73 => array( 2073, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31 ),
     315            74 => array( 2074, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30 ),
     316            75 => array( 2075, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     317            76 => array( 2076, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30 ),
     318            77 => array( 2077, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31 ),
     319            78 => array( 2078, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30 ),
     320            79 => array( 2079, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
     321            80 => array( 2080, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30 ),
     322            81 => array( 2081, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30 ),
     323            82 => array( 2082, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30 ),
     324            83 => array( 2083, 31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30 ),
     325            84 => array( 2084, 31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30 ),
     326            85 => array( 2085, 31, 32, 31, 32, 30, 31, 30, 30, 29, 30, 30, 30 ),
     327            86 => array( 2086, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30 ),
     328            87 => array( 2087, 31, 31, 32, 31, 31, 31, 30, 30, 29, 30, 30, 30 ),
     329            88 => array( 2088, 30, 31, 32, 32, 30, 31, 30, 30, 29, 30, 30, 30 ),
     330            89 => array( 2089, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30 ),
     331            90 => array( 2090, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30 ),
    342332        );
    343333
     
    348338         * @access private
    349339         * @since 1.0
    350          *
    351340         */
    352341        private $date_data = array(
    353             'eng_date'=>array(
    354                 'year'=>'',
    355                 'month'=>'',
    356                 'date'=>''
     342            'eng_date' => array(
     343                'year'  => '',
     344                'month' => '',
     345                'date'  => '',
    357346            ),
    358             'nep_date'=>array(
    359                 'year'=>'',
    360                 'month'=>'',
    361                 'date'=>''
     347            'nep_date' => array(
     348                'year'  => '',
     349                'month' => '',
     350                'date'  => '',
    362351            ),
    363             'from'=>'',
    364             'result'=>'',
     352            'from'     => '',
     353            'result'   => '',
    365354
    366355        );
     
    388377            // Always return the instance
    389378            return $instance;
    390 
    391379        }
    392380
     
    399387         * @return bool|string
    400388         */
    401         private function _is_in_range_eng($yy, $mm, $dd) {
    402             if ($yy < 1944 || $yy > 2033) {
    403                 return __("Supported only between 1944-2022",'nepali-date-converter');
    404             }
    405 
    406             if ($mm < 1 || $mm > 12) {
    407                 return __("Error! month value can be between 1-12 only",'nepali-date-converter');
    408             }
    409 
    410             if ($dd < 1 || $dd > 31) {
    411                 return __("Error! day value can be between 1-31 only",'nepali-date-converter');
    412             }
    413 
    414             return TRUE;
     389        private function _is_in_range_eng( $yy, $mm, $dd ) {
     390            if ( $yy < 1944 || $yy > 2033 ) {
     391                return __( 'Supported only between 1944-2022', 'nepali-date-converter' );
     392            }
     393
     394            if ( $mm < 1 || $mm > 12 ) {
     395                return __( 'Error! month value can be between 1-12 only', 'nepali-date-converter' );
     396            }
     397
     398            if ( $dd < 1 || $dd > 31 ) {
     399                return __( 'Error! day value can be between 1-31 only', 'nepali-date-converter' );
     400            }
     401
     402            return true;
    415403        }
    416404
     
    423411         * @return bool
    424412         */
    425         private function _is_in_range_nep($yy, $mm, $dd) {
    426             if ($yy < 2000 || $yy > 2089) {
    427                 return __("Supported only between 2000-2089",'nepali-date-converter');
    428             }
    429 
    430             if ($mm < 1 || $mm > 12) {
    431                 return __("Error! month value can be between 1-12 only",'nepali-date-converter');
    432             }
    433 
    434             if ($dd < 1 || $dd > 32) {
    435                 return __("Error! day value can be between 1-31 only",'nepali-date-converter');
    436             }
    437 
    438             return TRUE;
     413        private function _is_in_range_nep( $yy, $mm, $dd ) {
     414            if ( $yy < 2000 || $yy > 2089 ) {
     415                return __( 'Supported only between 2000-2089', 'nepali-date-converter' );
     416            }
     417
     418            if ( $mm < 1 || $mm > 12 ) {
     419                return __( 'Error! month value can be between 1-12 only', 'nepali-date-converter' );
     420            }
     421
     422            if ( $dd < 1 || $dd > 32 ) {
     423                return __( 'Error! day value can be between 1-31 only', 'nepali-date-converter' );
     424            }
     425
     426            return true;
    439427        }
    440428
     
    445433         * @return bool
    446434         */
    447         public function is_leap_year($year) {
     435        public function is_leap_year( $year ) {
    448436            $a = $year;
    449             if ($a % 100 == 0) {
    450                 if ($a % 400 == 0)
    451                 {
    452                     return TRUE;
    453                 }
    454                 else
    455                 {
    456                     return FALSE;
    457                 }
    458             }
    459             else {
    460                 if ($a % 4 == 0)
    461                 {
    462                     return TRUE;
    463                 }
    464                 else
    465                 {
    466                     return FALSE;
    467                 }
     437            if ( $a % 100 == 0 ) {
     438                if ( $a % 400 == 0 ) {
     439                    return true;
     440                } else {
     441                    return false;
     442                }
     443            } elseif ( $a % 4 == 0 ) {
     444
     445                    return true;
     446            } else {
     447                return false;
    468448            }
    469449        }
     
    477457         * @return array
    478458         */
    479         public function eng_to_nep( $input_date = array(),$date_format = 'nep_char', $format = 'D, F j, Y' ) {
     459        public function eng_to_nep( $input_date = array(), $date_format = 'nep_char', $format = 'D, F j, Y' ) {
    480460
    481461            // Check for date range
     
    484464            $dd = $input_date['day'];
    485465
    486             $chk = $this->_is_in_range_eng($yy, $mm, $dd);
    487 
    488             if($chk !== TRUE) {
    489                 die($chk);
    490             }
    491             else {
    492 
    493                 $this->date_data['from'] = 'eng';
    494                 $this->date_data['eng_date']['year']= $yy;
    495                 $this->date_data['eng_date']['month']= $mm;
    496                 $this->date_data['eng_date']['date']= $dd;
     466            $chk = $this->_is_in_range_eng( $yy, $mm, $dd );
     467
     468            if ( $chk !== true ) {
     469                die( $chk );
     470            } else {
     471
     472                $this->date_data['from']              = 'eng';
     473                $this->date_data['eng_date']['year']  = $yy;
     474                $this->date_data['eng_date']['month'] = $mm;
     475                $this->date_data['eng_date']['date']  = $dd;
    497476                // Month data.
    498                 $month  = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
     477                $month = array( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 );
    499478
    500479                // Month for leap year
    501                 $lmonth = array(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
    502 
    503                 $def_eyy     = 1944;    // initial english date.
     480                $lmonth = array( 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 );
     481
     482                $def_eyy     = 1944;    // initial english date.
    504483                $def_nyy     = 2000;
    505484                $def_nmm     = 9;
    506                 $def_ndd     = 17 - 1;  // inital nepali date.
     485                $def_ndd     = 17 - 1;  // inital nepali date.
    507486                $total_eDays = 0;
    508                 $np_date = 0;
     487                $np_date     = 0;
    509488                $a           = 0;
    510489                $day         = 7 - 1;
     
    516495
    517496                // Count total no. of days in-terms year
    518                 for ($i = 0; $i < ($yy - $def_eyy); $i++) //total days for month calculation...(english)
    519                 {
    520                     if ($this->is_leap_year($def_eyy + $i) === TRUE)
    521                     {
    522                         for ($j = 0; $j < 12; $j++)
    523                         {
    524                             $total_eDays += $lmonth[$j];
     497                for ( $i = 0; $i < ( $yy - $def_eyy ); $i++ ) {
     498                    if ( $this->is_leap_year( $def_eyy + $i ) === true ) {
     499                        for ( $j = 0; $j < 12; $j++ ) {
     500                            $total_eDays += $lmonth[ $j ];
    525501                        }
    526                     }
    527                     else
    528                     {
    529                         for ($j = 0; $j < 12; $j++)
    530                         {
    531                             $total_eDays += $month[$j];
     502                    } else {
     503                        for ( $j = 0; $j < 12; $j++ ) {
     504                            $total_eDays += $month[ $j ];
    532505                        }
    533506                    }
     
    535508
    536509                // Count total no. of days in-terms of month
    537                 for ($i = 0; $i < ($mm - 1); $i++)
    538                 {
    539                     if ($this->is_leap_year($yy) === TRUE)
    540                     {
    541                         $total_eDays += $lmonth[$i];
    542                     }
    543                     else
    544                     {
    545                         $total_eDays += $month[$i];
     510                for ( $i = 0; $i < ( $mm - 1 ); $i++ ) {
     511                    if ( $this->is_leap_year( $yy ) === true ) {
     512                        $total_eDays += $lmonth[ $i ];
     513                    } else {
     514                        $total_eDays += $month[ $i ];
    546515                    }
    547516                }
     
    550519                $total_eDays += $dd;
    551520
    552 
    553                 $i           = 0;
    554                 $j           = $def_nmm;
     521                $i       = 0;
     522                $j       = $def_nmm;
    555523                $np_date = $def_ndd;
    556                 $m           = $def_nmm;
    557                 $y           = $def_nyy;
     524                $m       = $def_nmm;
     525                $y       = $def_nyy;
    558526
    559527                // Count nepali date from array
    560                 while ($total_eDays != 0)
    561                 {
    562                     $a = $this->_c_bs[$i][$j];
    563 
    564                     $np_date++;     //count the days
    565                     $day++;             //count the days interms of 7 days
    566 
    567                     if ($np_date > $a)
    568                     {
    569                         $m++;
     528                while ( $total_eDays != 0 ) {
     529                    $a = $this->_c_bs[ $i ][ $j ];
     530
     531                    ++$np_date;     // count the days
     532                    ++$day;             // count the days interms of 7 days
     533
     534                    if ( $np_date > $a ) {
     535                        ++$m;
    570536                        $np_date = 1;
    571                         $j++;
    572                     }
    573 
    574                     if ($day > 7)
    575                     {
     537                        ++$j;
     538                    }
     539
     540                    if ( $day > 7 ) {
    576541                        $day = 1;
    577542                    }
    578543
    579                     if ($m > 12)
    580                     {
    581                         $y++;
     544                    if ( $m > 12 ) {
     545                        ++$y;
    582546                        $m = 1;
    583547                    }
    584548
    585                     if ($j > 12)
    586                     {
     549                    if ( $j > 12 ) {
    587550                        $j = 1;
    588                         $i++;
    589                     }
    590 
    591                     $total_eDays--;
    592                 }
    593 
    594                 /*Date Formatting
     551                        ++$i;
     552                    }
     553
     554                    --$total_eDays;
     555                }
     556
     557                /*
     558                Date Formatting
    595559                 * no supported
    596560                S, c, r, U
    597                  may be c= $y.'-'.$m.'-'.$np_date.'स'.date('H',$create_date).':'.date('i',$create_date).':'.date('s',$create_date).'+00:00',
     561                may be c= $y.'-'.$m.'-'.$np_date.'स'.date('H',$create_date).':'.date('i',$create_date).':'.date('s',$create_date).'+00:00',
    598562                */
    599563                /*Optional*/
    600                 $hour = isset($input_date['hour'])?$input_date['hour']:'';
    601                 $min = isset($input_date['min'])?$input_date['min']:'';
    602                 $sec = isset($input_date['sec'])?$input_date['sec']:'';
    603 
    604                 $ndcDateStr = $yy.'-'.$mm.'-'.$dd;
    605                 if( $hour){
    606                     $ndcDateStr .= ' '.$hour;
    607                 }
    608                 if( $min){
    609                     $ndcDateStr .= ':'.$min;
    610                 }
    611                 if( $sec){
    612                     $ndcDateStr .= ':'.$sec;
     564                $hour = isset( $input_date['hour'] ) ? $input_date['hour'] : '';
     565                $min  = isset( $input_date['min'] ) ? $input_date['min'] : '';
     566                $sec  = isset( $input_date['sec'] ) ? $input_date['sec'] : '';
     567
     568                $ndcDateStr = $yy . '-' . $mm . '-' . $dd;
     569                if ( $hour ) {
     570                    $ndcDateStr .= ' ' . $hour;
     571                }
     572                if ( $min ) {
     573                    $ndcDateStr .= ':' . $min;
     574                }
     575                if ( $sec ) {
     576                    $ndcDateStr .= ':' . $sec;
    613577                }
    614578
     
    616580
    617581                $ndp_format = array(
    618                     'd' =>$this->getTwoCharStr($np_date),/*add 0 to front if one character*/
    619                     'j' =>$np_date,/*always j */
    620                     'l' =>date('l',$create_date),
    621                     'D' =>date('D',$create_date),
    622                     'm' =>$this->getTwoCharStr($m),
    623                     'n' =>$m,
    624                     'F' =>array_keys($this->long_eng_nep_mth)[(int)$m-1],
    625                     'M' =>array_keys($this->short_eng_nep_mth)[(int)$m-1],
    626                     'Y' =>$y,
    627                     'y' =>substr($y, 2),
    628                     'a' =>date('a',$create_date),
    629                     'A' =>date('A',$create_date),
    630                     'g' =>date('g',$create_date),
    631                     'h' =>date('h',$create_date),
    632                     'G' =>date('G',$create_date),
    633                     'H' =>date('H',$create_date),
    634                     'i' =>date('i',$create_date),
    635                     's' =>date('s',$create_date),
    636                     'T' =>date('T',$create_date),
    637                     'c' =>$y.'-'.$m.'-'.$np_date.'स'.date('H',$create_date).':'.date('i',$create_date).':'.date('s',$create_date).'+00:00',
    638                     'r' =>date('D',$create_date).', '.$np_date.' '.array_keys($this->short_eng_nep_mth)[(int)$m-1].' '.$y.' '.date('H',$create_date).':'.date('i',$create_date).':'.date('s',$create_date).'+0200'
     582                    'd' => $this->getTwoCharStr( $np_date ), /*add 0 to front if one character*/
     583                    'j' => $np_date, /*always j */
     584                    'l' => date( 'l', $create_date ),
     585                    'D' => date( 'D', $create_date ),
     586                    'm' => $this->getTwoCharStr( $m ),
     587                    'n' => $m,
     588                    'F' => array_keys( $this->long_eng_nep_mth )[ (int) $m - 1 ],
     589                    'M' => array_keys( $this->short_eng_nep_mth )[ (int) $m - 1 ],
     590                    'Y' => $y,
     591                    'y' => substr( $y, 2 ),
     592                    'a' => date( 'a', $create_date ),
     593                    'A' => date( 'A', $create_date ),
     594                    'g' => date( 'g', $create_date ),
     595                    'h' => date( 'h', $create_date ),
     596                    'G' => date( 'G', $create_date ),
     597                    'H' => date( 'H', $create_date ),
     598                    'i' => date( 'i', $create_date ),
     599                    's' => date( 's', $create_date ),
     600                    'T' => date( 'T', $create_date ),
     601                    'c' => $y . '-' . $m . '-' . $np_date . 'स' . date( 'H', $create_date ) . ':' . date( 'i', $create_date ) . ':' . date( 's', $create_date ) . '+00:00',
     602                    'r' => date( 'D', $create_date ) . ', ' . $np_date . ' ' . array_keys( $this->short_eng_nep_mth )[ (int) $m - 1 ] . ' ' . $y . ' ' . date( 'H', $create_date ) . ':' . date( 'i', $create_date ) . ':' . date( 's', $create_date ) . '+0200',
    639603                );
    640604
     
    642606
    643607                /*current actual date stored as temp*/
    644                 $temp_long_actual_nepali_day = 'coder'.$day.'nepal';
    645                 $temp_short_actual_nepali_day = 'coder'.$day.'nep';
    646                 $temp_long_eng_nep_day = array(
    647                     "Sunday" => $temp_long_actual_nepali_day,
    648                     "Monday" => $temp_long_actual_nepali_day,
    649                     "Tuesday" => $temp_long_actual_nepali_day,
    650                     "Wednesday" => $temp_long_actual_nepali_day,
    651                     "Thursday" => $temp_long_actual_nepali_day,
    652                     "Friday" => $temp_long_actual_nepali_day,
    653                     "Saturday"=> $temp_long_actual_nepali_day
     608                $temp_long_actual_nepali_day  = 'coder' . $day . 'nepal';
     609                $temp_short_actual_nepali_day = 'coder' . $day . 'nep';
     610                $temp_long_eng_nep_day        = array(
     611                    'Sunday'    => $temp_long_actual_nepali_day,
     612                    'Monday'    => $temp_long_actual_nepali_day,
     613                    'Tuesday'  => $temp_long_actual_nepali_day,
     614                    'Wednesday' => $temp_long_actual_nepali_day,
     615                    'Thursday' => $temp_long_actual_nepali_day,
     616                    'Friday'    => $temp_long_actual_nepali_day,
     617                    'Saturday'  => $temp_long_actual_nepali_day,
    654618                );
    655                 $temp_short_eng_nep_day = array(
    656                     "Sun" => $temp_short_actual_nepali_day,
    657                     "Mon" => $temp_short_actual_nepali_day,
    658                     "Tue" => $temp_short_actual_nepali_day,
    659                     "Wed" => $temp_short_actual_nepali_day,
    660                     "Thu" => $temp_short_actual_nepali_day,
    661                     "Fri" => $temp_short_actual_nepali_day,
    662                     "Sat"=> $temp_short_actual_nepali_day
     619                $temp_short_eng_nep_day       = array(
     620                    'Sun' => $temp_short_actual_nepali_day,
     621                    'Mon' => $temp_short_actual_nepali_day,
     622                    'Tue' => $temp_short_actual_nepali_day,
     623                    'Wed' => $temp_short_actual_nepali_day,
     624                    'Thu' => $temp_short_actual_nepali_day,
     625                    'Fri' => $temp_short_actual_nepali_day,
     626                    'Sat' => $temp_short_actual_nepali_day,
    663627                );
    664628
    665                 if( 'eng_char' == $date_format ){
     629                if ( 'eng_char' == $date_format ) {
    666630                    $nepali_date = strtr( $nepali_date, $this->long_eng_nep_mth_in_eng );
    667631                    $nepali_date = strtr( $nepali_date, $this->short_eng_nep_mth_in_eng );
    668632
    669                     $actual_long_nepali_day = array(
    670                         "coder1nepal" => 'Aaitabar',
    671                         "coder2nepal" => 'Sombar',
    672                         "coder3nepal" => 'Mangalbar',
    673                         "coder4nepal" => 'Budhabar',
    674                         "coder5nepal" => 'Bihibar',
    675                         "coder6nepal" => 'Sukrabar',
    676                         "coder7nepal"=> 'Sanibar'
     633                    $actual_long_nepali_day  = array(
     634                        'coder1nepal' => 'Aaitabar',
     635                        'coder2nepal' => 'Sombar',
     636                        'coder3nepal' => 'Mangalbar',
     637                        'coder4nepal' => 'Budhabar',
     638                        'coder5nepal' => 'Bihibar',
     639                        'coder6nepal' => 'Sukrabar',
     640                        'coder7nepal' => 'Sanibar',
    677641                    );
    678642                    $actual_short_nepali_day = array(
    679                         "coder1nep" => 'Aaita',
    680                         "coder2nep" => 'Som',
    681                         "coder3nep" => 'Mangal',
    682                         "coder4nep" => 'Budha',
    683                         "coder5nep" => 'Bihi',
    684                         "coder6nep" => 'Sukra',
    685                         "coder7nep"=> 'Sani'
     643                        'coder1nep' => 'Aaita',
     644                        'coder2nep' => 'Som',
     645                        'coder3nep' => 'Mangal',
     646                        'coder4nep' => 'Budha',
     647                        'coder5nep' => 'Bihi',
     648                        'coder6nep' => 'Sukra',
     649                        'coder7nep' => 'Sani',
    686650                    );
    687651                    /*changing the day*/
     
    693657                    /*AM/PM*/
    694658                    $amPmTranslate = array(
    695                         "am" => 'Bihana',
    696                         "pm" => 'Madyana',
     659                        'am' => 'Bihana',
     660                        'pm' => 'Madyana',
    697661                    );
    698                     $nepali_date = strtr( $nepali_date, $amPmTranslate );
    699                 }
    700                 else{
     662                    $nepali_date   = strtr( $nepali_date, $amPmTranslate );
     663                } else {
    701664                    $nepali_date = strtr( $nepali_date, $this->eng_nep_num );
    702665                    $nepali_date = strtr( $nepali_date, $this->long_eng_nep_mth );
    703666                    $nepali_date = strtr( $nepali_date, $this->short_eng_nep_mth );
    704667
    705                     $actual_long_nepali_day = array(
    706                         "coder1nepal" => 'आइतवार',
    707                         "coder2nepal" => 'सोमवार',
    708                         "coder3nepal" => 'मङ्लबार',
    709                         "coder4nepal" => 'बुधबार',
    710                         "coder5nepal" => 'बिहिबार',
    711                         "coder6nepal" => 'शुक्रबार',
    712                         "coder7nepal"=> 'शनिबार'
     668                    $actual_long_nepali_day  = array(
     669                        'coder1nepal' => 'आइतवार',
     670                        'coder2nepal' => 'सोमवार',
     671                        'coder3nepal' => 'मङ्लबार',
     672                        'coder4nepal' => 'बुधबार',
     673                        'coder5nepal' => 'बिहिबार',
     674                        'coder6nepal' => 'शुक्रबार',
     675                        'coder7nepal' => 'शनिबार',
    713676                    );
    714677                    $actual_short_nepali_day = array(
    715                         "coder1nep" => 'आइत',
    716                         "coder2nep" => 'सोम',
    717                         "coder3nep" => 'मङ्ल',
    718                         "coder4nep" => 'बुध',
    719                         "coder5nep" => 'बिहि',
    720                         "coder6nep" => 'शुक्र',
    721                         "coder7nep"=> 'शनि'
     678                        'coder1nep' => 'आइत',
     679                        'coder2nep' => 'सोम',
     680                        'coder3nep' => 'मङ्ल',
     681                        'coder4nep' => 'बुध',
     682                        'coder5nep' => 'बिहि',
     683                        'coder6nep' => 'शुक्र',
     684                        'coder7nep' => 'शनि',
    722685                    );
    723686
     
    730693                    /*AM/PM*/
    731694                    $amPmTranslate = array(
    732                         "am" => 'बिहान',
    733                         "pm" => 'मध्यान्ह',
     695                        'am' => 'बिहान',
     696                        'pm' => 'मध्यान्ह',
    734697                    );
    735                     $nepali_date = strtr( $nepali_date, $amPmTranslate );
    736                 }
    737 
    738                 $this->date_data['nep_date']['year']= $y;
    739                 $this->date_data['nep_date']['month']= $m;
    740                 $this->date_data['nep_date']['date']= $np_date;
    741                 $this->date_data['result']= $nepali_date;
     698                    $nepali_date   = strtr( $nepali_date, $amPmTranslate );
     699                }
     700
     701                $this->date_data['nep_date']['year']  = $y;
     702                $this->date_data['nep_date']['month'] = $m;
     703                $this->date_data['nep_date']['date']  = $np_date;
     704                $this->date_data['result']            = $nepali_date;
    742705                return $this->date_data;
    743706            }
     
    753716         * @return array
    754717         */
    755         public function nep_to_eng($input_date = array() ,$format = 'D, F j, Y' ) {
     718        public function nep_to_eng( $input_date = array(), $format = 'D, F j, Y' ) {
    756719            // Check for date range
    757             $yy = $input_date['year'];
    758             $mm = $input_date['month'];
    759             $dd = $input_date['day'];
     720            $yy          = $input_date['year'];
     721            $mm          = $input_date['month'];
     722            $dd          = $input_date['day'];
    760723            $def_eyy     = 1943;
    761724            $def_emm     = 4;
    762             $def_edd     = 14 - 1;  // initial english date.
     725            $def_edd     = 14 - 1;  // initial english date.
    763726            $def_nyy     = 2000;
    764727            $def_nmm     = 1;
    765             $def_ndd     = 1;       // iniital equivalent nepali date.
     728            $def_ndd     = 1;       // iniital equivalent nepali date.
    766729            $total_eDays = 0;
    767             $np_date = 0;
     730            $np_date     = 0;
    768731            $a           = 0;
    769732            $day         = 4 - 1;
     
    787750                31,
    788751                30,
    789                 31
     752                31,
    790753            );
    791754            $lmonth = array(
     
    802765                31,
    803766                30,
    804                 31
     767                31,
    805768            );
    806769
    807770            // Check for date range
    808             $chk = $this->_is_in_range_nep($yy, $mm, $dd);
    809 
    810             if ( $chk !== TRUE)
    811             {
    812                 die($chk);
    813             }
    814             else
    815             {
    816                 $this->date_data['from'] = 'nep';
    817                 $this->date_data['nep_date']['year']= $yy;
    818                 $this->date_data['nep_date']['month']= $mm;
    819                 $this->date_data['nep_date']['date']= $dd;
     771            $chk = $this->_is_in_range_nep( $yy, $mm, $dd );
     772
     773            if ( $chk !== true ) {
     774                die( $chk );
     775            } else {
     776                $this->date_data['from']              = 'nep';
     777                $this->date_data['nep_date']['year']  = $yy;
     778                $this->date_data['nep_date']['month'] = $mm;
     779                $this->date_data['nep_date']['date']  = $dd;
    820780
    821781                // Count total days in-terms of year
    822                 for ($i = 0; $i < ($yy - $def_nyy); $i++)
    823                 {
    824                     for ($j = 1; $j <= 12; $j++)
    825                     {
    826                         $np_date += $this->_c_bs[$k][$j];
    827                     }
    828                     $k++;
     782                for ( $i = 0; $i < ( $yy - $def_nyy ); $i++ ) {
     783                    for ( $j = 1; $j <= 12; $j++ ) {
     784                        $np_date += $this->_c_bs[ $k ][ $j ];
     785                    }
     786                    ++$k;
    829787                }
    830788
    831789                // Count total days in-terms of month
    832                 for ($j = 1; $j < $mm; $j++)
    833                 {
    834                     $np_date += $this->_c_bs[$k][$j];
     790                for ( $j = 1; $j < $mm; $j++ ) {
     791                    $np_date += $this->_c_bs[ $k ][ $j ];
    835792                }
    836793
     
    842799                $m           = $def_emm;
    843800                $y           = $def_eyy;
    844                 while ($np_date != 0)
    845                 {
    846                     if ($this->is_leap_year($y))
    847                     {
    848                         $a = $lmonth[$m];
    849                     }
    850                     else
    851                     {
    852                         $a = $month[$m];
    853                     }
    854 
    855                     $total_eDays++;
    856                     $day++;
    857 
    858                     if ($total_eDays > $a)
    859                     {
    860                         $m++;
     801                while ( $np_date != 0 ) {
     802                    if ( $this->is_leap_year( $y ) ) {
     803                        $a = $lmonth[ $m ];
     804                    } else {
     805                        $a = $month[ $m ];
     806                    }
     807
     808                    ++$total_eDays;
     809                    ++$day;
     810
     811                    if ( $total_eDays > $a ) {
     812                        ++$m;
    861813                        $total_eDays = 1;
    862                         if ($m > 12)
    863                         {
    864                             $y++;
     814                        if ( $m > 12 ) {
     815                            ++$y;
    865816                            $m = 1;
    866817                        }
    867818                    }
    868819
    869                     if ($day > 7)
    870                     {
     820                    if ( $day > 7 ) {
    871821                        $day = 1;
    872822                    }
    873823
    874                     $np_date--;
    875                 }
    876 
    877                 $date_formatting_string = $y.'-'.$m.'-'.$total_eDays;
    878                 $create_date = date_create( $date_formatting_string );
    879                 $formatted_date = date_format( $create_date, $format );
    880 
    881                 $this->date_data['eng_date']['year']= $y;
    882                 $this->date_data['eng_date']['month']= $m;
    883                 $this->date_data['eng_date']['date']= $total_eDays;
    884                 $this->date_data['result']= $formatted_date;
     824                    --$np_date;
     825                }
     826
     827                $date_formatting_string = $y . '-' . $m . '-' . $total_eDays;
     828                $create_date            = date_create( $date_formatting_string );
     829                $formatted_date         = date_format( $create_date, $format );
     830
     831                $this->date_data['eng_date']['year']  = $y;
     832                $this->date_data['eng_date']['month'] = $m;
     833                $this->date_data['eng_date']['date']  = $total_eDays;
     834                $this->date_data['result']            = $formatted_date;
    885835
    886836                return $this->date_data;
     
    896846 * @since    2.0.0
    897847 */
    898 if( !function_exists( 'ndc_nepali_calendar')){
     848if ( ! function_exists( 'ndc_nepali_calendar' ) ) {
    899849
    900850    function ndc_nepali_calendar() {
  • nepali-date-converter/trunk/nepali-date-converter.php

    r3066175 r3103095  
    44Plugin URI: https://www.addonspress.com/wordpress-plugins/nepali-date-converter/
    55Description: Convert English to Nepali Date and Vice Versa and Post Date to Nepali Date.
    6 Version: 2.0.6
     6Version: 2.0.7
    77Author: addonspress
    88Author URI: https://www.addonspress.com/
     
    1717}
    1818/*Define Constants for this plugin*/
    19 define( 'NEPALI_DATE_CONVERTER_VERSION', '2.0.6' );
     19define( 'NEPALI_DATE_CONVERTER_VERSION', '2.0.7' );
    2020define( 'NEPALI_DATE_CONVERTER_PATH', plugin_dir_path( __FILE__ ) );
    2121define( 'NEPALI_DATE_CONVERTER_URL', plugin_dir_url( __FILE__ ) );
  • nepali-date-converter/trunk/readme.txt

    r3066175 r3103095  
    55Requires at least: 4.9
    66Tested up to: 6.5
    7 Stable tag: 2.0.6
     7Stable tag: 2.0.7
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1212
    1313== Description ==
     14
     15If you're looking for a sleek and functional WordPress theme that integrates seamlessly with a Nepali date converter plugin,
     16check out this [free WordPress theme: CosmosWP](https://wordpress.org/themes/cosmoswp/). It comes with a [demo showcasing the Nepali date converter](https://demo.cosmoswp.com/demo-99/) plugin in action.
    1417
    1518Newly Added Feature: Convert Post Dates to Nepali Dates. Access the setting under Admin => Setting => General.
     
    137140== Changelog ==
    138141
    139 = 2.0.6 - 2023-04-07 =
     142= 2.0.7 - 2024-06-15 =
     143* Fixed : [Date issue](https://wordpress.org/support/topic/jestha-32-is-not-showing/)
     144
     145= 2.0.6 - 2024-04-07 =
    140146* Updated : Tested up WordPress 6.5
    141147
Note: See TracChangeset for help on using the changeset viewer.