daily pastebin goal
12%
SHARE
TWEET

Untitled

a guest May 17th, 2018 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. function dias_feriados( $year = null ){
  3.     if( $year === null ){
  4.         $year = intval( date( 'Y' ) );
  5.     }
  6.  
  7.     /**
  8.      * easter_date() will generate a warning
  9.      * if the year is outside of the range
  10.      * for Unix timestamps (i.e. before 1970 or after 2037).
  11.      */
  12.     $easter       = easter_date( $year );
  13.     $easter_day   = date( 'j', $easter );
  14.     $easter_month = date( 'n', $easter );
  15.     $easter_year  = date( 'Y', $easter );
  16.  
  17.     $feriados = array(
  18.         mktime( 0, 0, 0, 1,  1,   $year ), // Confraternização Universal
  19.         mktime( 0, 0, 0, 4,  21,  $year ), // Tiradentes
  20.         mktime( 0, 0, 0, 5,  1,   $year ), // Dia do Trabalhador
  21.         mktime( 0, 0, 0, 6,  12,  $year ), // Dia dos Namorados
  22.         mktime( 0, 0, 0, 6,  24,  $year ), // Dia de São João
  23.         mktime( 0, 0, 0, 9,  7,   $year ), // Dia da Independência
  24.         mktime( 0, 0, 0, 10,  12, $year ), // N. S. Aparecida
  25.         mktime( 0, 0, 0, 11,  2,  $year ), // Todos os santos
  26.         mktime( 0, 0, 0, 11, 15,  $year ), // Proclamação da republica
  27.         mktime( 0, 0, 0, 12, 25,  $year ), // Natal
  28.  
  29.         // These days have a date depending on easter
  30.         mktime( 0, 0, 0, $easter_month, $easter_day - 48,  $easter_year ), //2ºferia Carnaval
  31.         mktime( 0, 0, 0, $easter_month, $easter_day - 47,  $easter_year ), //3ºferia Carnaval 
  32.         mktime( 0, 0, 0, $easter_month, $easter_day - 2 ,  $easter_year ), //6ºfeira Santa  
  33.         mktime( 0, 0, 0, $easter_month, $easter_day     ,  $easter_year ), //Pascoa
  34.         mktime( 0, 0, 0, $easter_month, $easter_day + 60,  $easter_year ), //Corpus Cirist
  35.     );
  36.  
  37.     sort( $feriados );
  38.    
  39.     return $feriados;
  40. }
RAW Paste Data
Top