get('Version') ); } add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' ); add_filter( 'body_class', 'custom_class' ); function custom_class( $classes ) { /* if ( is_page_template( 'page-example.php' ) ) { $classes[] = 'example'; } */ if (is_archive()) { $classes[] = 'page-template-tpl-blog'; } return $classes; } function RelativeTime() { $jour = get_the_date('U'); $aujourdhui = date('U'); $delta = round(($aujourdhui - $jour) / (3600 * 24)); if ($delta == 0) $text = "aujourd'hui"; elseif ($delta == 1) $text = __("yesterday", 'CreatorThemeRes-child'); elseif ($delta == 2) $text = __("the day before yesterday", 'CreatorThemeRes-child'); elseif ($delta == 3) $text = __("two days ago", 'CreatorThemeRes-child'); elseif (($delta > 3) and ($delta <= 7)) $text = sprintf( __('%1$s days ago', 'CreatorThemeRes-child'), $delta ); elseif (($delta > 7) and ($delta <= 14)) { $nb = round ($delta / 7); if ($nb < 2) $text = sprintf( __('%1$s week ago', 'CreatorThemeRes-child'), $nb ); else $text = sprintf( __('%1$s weeks ago', 'CreatorThemeRes-child'), $nb ); } else $text = get_the_date(); /* printf( __( '%1$s', 'CreatorThemeRes-child' ), sprintf( ''.$text.'', get_permalink(), esc_attr( get_the_date() . ' ' . get_the_time() ) ) ); */ echo $text; } function getRandomFile($start_dir) { chdir($start_dir); $dir = opendir('.'); while (($myfile = readdir($dir)) !==false) { if ($myfile != '.' && $myfile != '..' && is_file($myfile) && $myfile != 'resource.frk') { $files[] = $myfile; } } closedir($dir); chdir('../'); srand ((float) microtime() * 10000000); $file = array_rand($files); return $files[$file]; } function preprint($s, $return=false) { $x = "
"; 
    $x .= print_r($s, 1); 
    $x .= "
"; if ($return) return $x; else print $x; } /* photo du mois */ function exif_date($date,$apn) { //'Model' => string 'Canon EOS 50D' (length=13) //50D: 'DateTimeOriginal' => string '2009:12:05 12:42:33' (length=19) //'Model' => string 'Canon EOS 7D' (length=12) //7D: DateTimeOriginal' => string '2010-02-20T15:07:05.24+01:00' (length=28) // -> 50D if (!preg_match("/7D/", $apn)) { $pieces = explode(' ', $date); list($yy, $mm, $dd) = explode(':', $pieces[0]); list($hh, $min, $ss) = explode(':', $pieces[1]); } // 7D else { $pieces = explode('T', $date); list($yy, $mm, $dd) = explode('-', $pieces[0]); $pieces_h = explode('.', $pieces[1]); list($hh, $min, $ss) = explode(':', $pieces_h[0]); } $timestamp = mktime((int) $hh, (int) $min, (int) $ss, (int) $mm, (int) $dd, (int) $yy, '-1'); $date = date('d.m.Y à H:i',$timestamp); return $date; } function mois2 ($mois) { switch ($mois) { case 00: $mois = "00"; break; case 1: $mois = __('January','CreatorThemeRes-child'); break; case 2: $mois = __('February','CreatorThemeRes-child'); break; case 3: $mois = __('March','CreatorThemeRes-child'); break; case 4: $mois = __('April','CreatorThemeRes-child'); break; case 5: $mois = __('May','CreatorThemeRes-child'); break; case 6: $mois = __('June','CreatorThemeRes-child'); break; case 7: $mois = __('July','CreatorThemeRes-child'); break; case 8: $mois = __('August','CreatorThemeRes-child'); break; case 9: $mois = __('September','CreatorThemeRes-child'); break; case 10: $mois = __('October','CreatorThemeRes-child'); break; case 11: $mois = __('November','CreatorThemeRes-child'); break; case 12: $mois = __('December','CreatorThemeRes-child'); break; } return $mois; } function display ($filename,$album) { $display = '
'. '
' . ''. ''. ''. '
'. '
'. ''. ''.date_archive($filename).''. '
'. '
'; return $display; } function displayRetina ($filename,$album) { // 6_2012.jpg // 4_2014_180_thumb.jpg 4_2014_360_thumb.jpg $path = "../zenphoto/cache/" . $album . "/"; $file = explode(".", $filename); //$a = $path . $filename; //echo $a. "
"; $file_sd = $path . $file[0] . "_180_thumb.jpg"; $file_hd = $path . $file[0] . "_360_thumb.jpg"; /* $file_sd = $path . $file[0] . "_180_watermark.jpg"; $file_hd = $path . $file[0] . "_360_watermark.jpg"; */ // $th_sd = false; $th_hd = false; if (file_exists($file_sd)) { $th_sd = true; $size_sd = getimagesize($file_sd, $info); $thumb['sd'] = array( 'url' => "../" . $file_sd, 'width' => $size_sd[0], 'height' => $size_sd[1] ); } if (file_exists($file_hd)) { $th_hd = true; $size_hd = getimagesize($file_hd, $info); $thumb['hd'] = array( 'url' => "../" . $file_hd, 'width' => $size_hd[0], 'height' => $size_hd[1] ); } //preprint($thumb); if (($th_sd == true) && ($th_hd == true)) { $standard = $thumb['sd']['url'] . ', ' . $thumb['hd']['url'] . ' 2x'; } elseif ($th_sd == true) { $standard = $thumb['sd']['url']; } elseif ($th_hd == true) { $standard = $thumb['hd']['url'] . ' 2x'; } $display = '
'; $display .= '
'; $display .= ''; $display .= ''; $display .= ''; $display .= ''; //$display .= ''; $display .= ''; $display .= ''; $display .= ''; $display .= ''; $display .= '
'; $display .= '
'; $display .= ''; $display .= ''.date_archive($filename).''; $display .= '
'; $display .= '
'; return $display; } function get_image_title ($photo) { $photo = '../zenphoto/albums/photos-du-mois/' . $photo; $size = getimagesize($photo, $info); if (isset($info["APP13"])) { $iptc = iptcparse($info["APP13"]); //print_r($iptc); $caption = isset($iptc['2#120'][0]); $graphic_name = isset($iptc['2#005'][0]); } return $caption; } function date_archive ($chaine) { $pieces = explode(".", $chaine); $b = explode("_", $pieces[0]); $mois = $b[0]; $an = $b[1]; $chaine = mois2($mois) . ' '. $an; return $chaine; } ?>