$serial ) ); update_option( 'wr2x_pro_status', _( "Your subscription is manually enabled." ) ); update_option( 'wr2x_pro_serial', _( $serial ) ); set_transient( 'wr2x_validated', $serial, 3600 * 24 * 100 ); /* add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' ); function enqueue_parent_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' ); } */ /**/ //add_action( 'init', 'add_author_rules' ); /* function add_author_rules() { add_rewrite_rule( "en-cours-2-page-?([0-9]{1,})/?", "index.php?page_id=804&toto=$matches[1]", "top"); $wp_rewrite->flush_rules(); } */ function google_jquery() { if (!is_admin()) { wp_deregister_script('jquery'); //wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js', false, '3.1.1'); wp_register_script('jquery', get_stylesheet_directory_uri() . '/js/jquery.min.js', false, '3.1.1'); wp_enqueue_script('jquery'); } } add_action('init', 'google_jquery'); function enqueue_my_scripts() { $lightbox_choice = dess_setting('dess_lightbox_choice'); if ($lightbox_choice == 'c') { //featherlight : http://noelboss.github.io/featherlight/ //selector: class="gallery" //wp_enqueue_script('jquery'); //include jQuery version bundled with Wordpress in your page //wp_enqueue_style( 'featherlight', 'http://cdn.rawgit.com/noelboss/featherlight/1.7.0/release/featherlight.min.css' ); wp_enqueue_style( 'featherlight', get_stylesheet_directory_uri() . '/css/featherlight.min.css' ); //wp_enqueue_style( 'featherlight-gallery', 'http://cdn.rawgit.com/noelboss/featherlight/1.3.4/release/featherlight.gallery.min.css' ); wp_enqueue_style( 'featherlight-gallery', get_stylesheet_directory_uri() . '/css/featherlight.gallery.min.css' ); wp_enqueue_style( 'featherlight2', get_stylesheet_directory_uri() . '/css/my-featherlight.css' ); //wp_enqueue_script( 'featherlight', 'http://cdn.rawgit.com/noelboss/featherlight/1.7.0/release/featherlight.min.js', array( 'jquery' ), '',true ); wp_enqueue_script( 'featherlight', get_stylesheet_directory_uri() . '/js/featherlight.min.js', array( 'jquery' ), '',true ); //wp_enqueue_script( 'featherlight-gallery', 'http://cdn.rawgit.com/noelboss/featherlight/1.3.4/release/featherlight.gallery.min.js', array( 'jquery', 'featherlight' ), '',true ); wp_enqueue_script( 'featherlight-gallery', get_stylesheet_directory_uri() . '/js/featherlight.gallery.min.js', array( 'jquery', 'featherlight' ), '',true ); wp_enqueue_script( 'featherlight-script', get_stylesheet_directory_uri() . '/js/featherlight.js', array( 'jquery', 'featherlight' ), '',true ); } if ($lightbox_choice == 'b') { //colorbox : http://www.jacklmoore.com/colorbox/ //selector: class="slideshow" (ou "gallery") wp_enqueue_script( 'colorbox', get_stylesheet_directory_uri() . '/js/jquery.colorbox-min.js', array( 'jquery' ), '',false ); wp_enqueue_style( 'colorbox', get_stylesheet_directory_uri() . '/css/colorbox.css' ); wp_enqueue_script( 'colorbox-options', get_stylesheet_directory_uri() . '/js/my-colorbox.js', array( 'jquery', 'colorbox' ), '',true ); } if ($lightbox_choice == 'a') { //meow-box } //ionicons: http://ionicons.com //wp_enqueue_style( 'ionicons', 'http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css' ); wp_enqueue_style( 'ionicons', get_stylesheet_directory_uri() . '/css/ionicons.min.css' ); //wp_enqueue_script( 'googlemaps', ''; } add_action( 'wp_enqueue_scripts', 'enqueue_my_scripts' ); /**/ function my_theme_enqueue_styles() { //$parent_style = 'CreatorThemeRes-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme. $parent_style = 'parent_style'; //wp_enqueue_style( 'genericons', get_stylesheet_directory_uri() . '/genericons/genericons.css' ); wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( $parent_style ), wp_get_theme()->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; } // Bouton Shortcode zenphoto dans l'éditeur function register_button( $buttons ) { array_push( $buttons, "|", "zenphoto" ); return $buttons; } function add_plugin( $plugin_array ) { $plugin_array['zenphoto'] = get_stylesheet_directory_uri() . '/js/short-zenphoto.js'; return $plugin_array; } function my_zenphoto_button() { if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) { return; } if ( get_user_option('rich_editing') == 'true' ) { add_filter( 'mce_external_plugins', 'add_plugin' ); add_filter( 'mce_buttons', 'register_button' ); } } add_action('init', 'my_zenphoto_button'); 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) { global $ppage; if ($ppage == "1") { $fullpath = "../../zenphoto/"; } else { $fullpath = "../../../zenphoto/"; } $file = explode(".", $filename); $thumbpath = "../zenphoto/cache/" . $album . "/"; $a = $path . $filename; //echo $a. "
"; $file_sd = $thumbpath . $file[0] . "_180_thumb.jpg"; $file_hd = $thumbpath . $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 .= ''.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; } function flickr_handler($atts, $content=null) { // flickr = pas d'exifs $link = ! empty( $atts['link'] ) ? $atts['link'] : ''; $link = filter_var($link, FILTER_SANITIZE_URL); $small = ! empty( $atts['small'] ) ? $atts['small'] : ''; $small = filter_var($small, FILTER_SANITIZE_URL); $big = ! empty( $atts['big'] ) ? $atts['big'] : ''; $big = filter_var($big, FILTER_SANITIZE_URL); $alt = ! empty( $atts['alt'] ) ? $atts['alt'] : ''; $alt = filter_var($alt, FILTER_SANITIZE_URL); // Notice: Undefined index: caption $caption = ! empty( $atts['caption'] ) ? $atts['caption'] : ''; // Sanitize $caption = filter_var($caption, FILTER_SANITIZE_STRING); $lb = ! empty( $atts['lb'] ) ? $atts['lb'] : ''; $lb = filter_var($lb, FILTER_SANITIZE_STRING); $info = array(); // 1220 -610 $lb = toBool($lb); $rnd = rand (1000, 9999); $selector = dess_setting('dess_lightbox_select'); $flickr_size = getimagesize(htmlentities($small), $info); if (isset($info["APP13"])) { $iptc = iptcparse($info["APP13"]); //var_dump($iptc); } //else echo "no info !!"; $links = (($caption != "") ? '
' : ''); $links .= ''; $links .= ''; $links .= ''; //$link .= ''; $links .= ''; $links .= ''; $links .= ''; $links .= ''; $links .= '' . $alt . ''; $links .= ''; $links .= (($caption != "") ? '

' . $caption . '

' : ''); return $links; } add_filter( 'the_content', 'do_shortcode'); add_shortcode( 'flickr', 'flickr_handler' ); function zenphoto_handler($atts, $content=null) { //utilise le cacheManager de zenphoto (extensions/utilitaires/cacheManager) // ** Utilisation ** // [zenphoto album="lievres" image="2008-08-18_Lievre_8927.jpg"] // [zenphoto album="sports-mecaniques/gp-france" image="2010-05-23_gp-france-2010_5321.jpg"] // [zenphoto album="lievres"] // //taille des photos dans Worpress, theme Twenty Ten Child : 610x406 $selector = dess_setting('dess_lightbox_select'); $zenphoto_url = dess_setting('dess_zenphoto'); $size = dess_setting('dess_zp_size'); /* $host = (($_SERVER['HTTPS'] != "") ? "https" : "http") . '://' . $_SERVER['HTTP_HOST'] . '/zenphoto/'; if (substr_count($zenphoto_url2, "https") == 1) { $zenphoto_url = (($_SERVER['HTTPS'] != "") ? substr_replace($zenphoto_url2, 'https', 0, 4) : $zenphoto_url2); } $zenphoto_url = $host; */ $album = ! empty( $atts['album'] ) ? $atts['album'] : ''; $album = filter_var($album, FILTER_SANITIZE_STRING); $image = ! empty( $atts['image'] ) ? $atts['image'] : ''; $image = filter_var($image, FILTER_SANITIZE_STRING); $size = 610; $folder = false; $zenphoto_img = ""; // Si ALBUM mais pas IMAGE //if ((isset($atts['album'])) && (!isset($atts['image']))) { if (($album != "") && ($image == "")) { require('../Connections/cnx.php'); $mysqli = new mysqli($dbhost, $dbuser, $dbpassword, $dbtable); if (mysqli_connect_errno()) { printf("Échec de la connexion : %s\n", mysqli_connect_error()); exit(); } // Trouver l'ID de l'album $album_id_query = "SELECT `id` FROM `" . $zp_prefix . "albums` WHERE `folder` = '" . $atts['album'] . "'"; if ($result = $mysqli->query($album_id_query)) { if ($mysqli->affected_rows != 0) { $row = $result->fetch_row(); $album_id = $row[0]; } else { _e("Unknow album.", 'CreatorThemeRes-child' ); } $result->close(); } // Trouver le filename de la plus récente image de l'album $img_album_query = "SELECT filename FROM `" . $zp_prefix . "images` WHERE `albumid` = '" . $album_id . "' ORDER BY `id` DESC LIMIT 1"; if ($result = $mysqli->query($img_album_query)) { if ($mysqli->affected_rows != 0) { $row = $result->fetch_row(); $img_album = $row[0]; } else { _e("Unknow image.", 'CreatorThemeRes-child' ); } $result->close(); } $image = $img_album; $folder = true; } /* if (isset($atts['folder'])) { if ($atts['folder'] == "true") $folder = true; } */ $img = substr($image, 0, strlen($image) - 4); $filename = $zenphoto_url . 'cache/' . $album . '/' . urlencode($img) . '_' . $size . '_watermark.jpg'; $zp_size = getimagesize(htmlentities($filename)); //if ($folder == false) $zenphoto_link = ''; //if ($folder == false) $zenphoto_link = ''; if ($folder == false) $zenphoto_link = ''; else $zenphoto_link = ''; $zenphoto_img .= $zenphoto_link; $zenphoto_img .= ' '; $zenphoto_img .= ''; /* $a = $atts['image']; $b = zp_query_exif($a); // ligne 808 if ($b['image_meta']['description'] != "") { $caption = ""; $caption .= '

'; $caption .= $b['image_meta']['description'] . '

'; $zenphoto_img .= $caption; } */ return $zenphoto_img; } add_shortcode( 'zenphoto', 'zenphoto_handler' ); function zp_query_exif($zpimage) { $exif = array(); require('../Connections/cnx.php'); $mysqli = new mysqli($dbhost, $dbuser, $dbpassword, $dbtable); if (mysqli_connect_errno()) { printf("Échec de la connexion : %s\n", mysqli_connect_error()); exit(); } $excquery = "SELECT `EXIFModel`, `EXIFDateTimeOriginal`, `EXIFExposureTime`, `EXIFFNumber`, `EXIFISOSpeedRatings`, `EXIFFocalLength`, "; $excquery .= "`EXIFGPSLatitude`, `EXIFGPSLatitudeRef`, `EXIFGPSLongitude`, `EXIFGPSLongitudeRef`, `EXIFGPSAltitude`, `EXIFGPSAltitudeRef`, "; $excquery .= "`desc`, `title`, `EXIFLensType`, `EXIFLensInfo`, `EXIFOrientation`, `credit`, `copyright`, `id` "; $excquery .= "FROM `" . $zp_prefix . "images` WHERE `filename` = \"$zpimage\""; //echo $excquery; if ($result = $mysqli->query($excquery)) { $exif = $result->fetch_row(); $result->close(); } //preprint($exif); /* Array ( - [0] => Canon EOS-1D Mark IV - [1] => 2014:10:21 14:42:26 - [2] => 1/80 sec - [3] => f/9 - [4] => 320 - [5] => 17 mm - [6] => 44,381861666667 - [7] => N - [8] => 4,4162216666667 - [9] => E - [10] => 104,1771m [11] => *AltitudeRef* - [12] => a:1:{s:5:"fr_FR";s:10:"Pont d'Arc";} *desc* - [13] => a:1:{s:5:"fr_FR";s:24:"2014-10-21_PontDArc_0406";} *title* [14] => *EXIFLensType* - [15] => EF17-40mm f/4L USM *EXIFLensInfo* - [16] => 1: Normal (0 degr�) *EXIFOrientation* - [17] => Bruno Pesenti *credit* - [18] => bruno@clicclac.info *copyright* - [19] => *id* ) */ $meta = array( 'aperture' => 0, 'credit' => '', 'camera' => '', 'caption' => '', 'created_timestamp' => 0, 'copyright' => '', 'focal_length' => 0, 'iso' => 0, 'shutter_speed' => 0, 'title' => '', 'orientation' => 0, 'latitude' => 0, 'longitude' => 0, 'altitude' => 0, 'lens' => '', 'keywords' => array(), ); if ( ! empty( $exif[3] ) ) { $meta['aperture'] = str_replace(",", ".", $exif[3]); } if ( ! empty( $exif[17] ) ) { if (((stripos($exif[17], "pesenti")) === true) || ($exif[17] == "")) $meta['credit'] = $exif[17]; } if ( ! empty( $exif[0] ) ) { $meta['camera'] = $exif[0]; } //caption if ( ! empty( $exif[12] ) ) { $desc = explode(':', $exif[12]); $description = explode('"', end($desc)); $meta['description'] = utf8_encode($description[1]); } if ( ! empty( $exif[1] ) ) { //$meta['created_timestamp'] = $exif[1]; $meta['created_timestamp'] = strtotime($exif[1]); } //*copyright if ( ! empty( $exif[5] ) ) { $meta['focal_length'] = $exif[5]; } if ( ! empty( $exif[4] ) ) { $meta['iso'] = $exif[4]; } if ( ! empty( $exif[2] ) ) { $shutter = explode(' ', $exif[2]); $meta['shutter_speed'] = $shutter[0]; } //title if ( ! empty( $exif[13] ) ) { //echo "exif: " . $exif[13] . "
"; // a:1:{s:5:"fr_FR";s:30:"2011-05-15_GP-France-2011_9798";} $titr = explode(':', $exif[13]); if (count($titr) == 1) { $meta['title'] = utf8_encode($titr[0]); } else { $titre = explode('"', end($titr)); $meta['title'] = utf8_encode($titre[1]); } } if ( ! empty( $exif[16] ) ) { $meta['orientation'] = $exif[16]; } if ( ! empty( $exif[6] ) ) { $lat = floatval(str_replace(",", ".", $exif[6])); $meta['latitude'] = number_format($lat, 6); } if ( ! empty( $exif[8] ) ) { $long = floatval(str_replace(",", ".", $exif[8])); $meta['longitude'] = number_format($long, 6); } if ( ! empty( $exif[10] ) ) { $alt = floatval(str_replace(",", ".", $exif[10])); $meta['altitude'] = number_format($alt); } if ( ! empty( $exif[15] ) ) { $meta['lens'] = $exif[15]; } if ( ! empty( $exif[18] ) ) { $meta['copyright'] = $exif[18]; } //keywords if ( ! empty( $exif[19] ) ) { $img = $exif[19]; $result2 = $mysqli->query("SELECT `tagid` FROM `" . $zp_prefix . "obj_to_tag` WHERE `type`='images' AND `objectid`='$img'"); if ($result2) { while ($row = $result2->fetch_row()) { $result3 = $mysqli->query("SELECT `name` FROM `" . $zp_prefix . "tags` WHERE `id`='" . $row[0] . "'"); $dbtag = $result3->fetch_row(); if ($dbtag) $tags[] = utf8_encode(ucfirst($dbtag[0])); } } $meta['keywords'] = $tags; } return $meta; } function add_class_lightbox($content) { $selector = dess_setting('dess_lightbox_select'); //$selector = "gallery"; //Check the page for link images direct to image (no trailing attributes) $string = '/<\/a>/i'; preg_match_all( $string, $content, $matches, PREG_SET_ORDER); //preprint($matches); //Check which attachment is referenced foreach ($matches as $val) { $slimbox_caption = ''; $post = get_post($val[5]); $slimbox_caption = esc_attr( $post->post_content ); //Replace the instance with the lightbox and title(caption) references. Won't fail if caption is empty. $string = ''; //echo "string" . "
" . $string; //$replace = ''; $replace = ''; //echo "replace" . "
" . $replace; $content = str_replace( $string, $replace, $content); } return $content; } //add_filter('the_content', 'add_class_lightbox', 2); if ( ! function_exists( 'creator_post_nav' ) ) : /** * Display navigation to next/previous post when applicable. * * @since Twenty Thirteen 1.0 */ function creator_post_nav() { global $post; // Don't print empty markup if there's nowhere to navigate. $previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) return; ?> ' . esc_html__( 'Sticky', 'CreatorThemeRes-child' ) . ''; if ( ! has_post_format( 'link' ) && 'post' == get_post_type() ) creator_entry_date(); // Translators: used between list items, there is a space after the comma. $categories_list = get_the_category_list( __( ', ', 'CreatorThemeRes-child' ) ); if ( $categories_list ) { echo ' ' . $categories_list . ''; } // Translators: used between list items, there is a space after the comma. $tag_list = get_the_tag_list( '', __( ', ', 'CreatorThemeRes-child' ) ); if ( $tag_list ) { echo ' ' . $tag_list . ''; } // Post author if ( 'post' == get_post_type() ) { printf( ' ', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'CreatorThemeRes-child' ), get_the_author() ) ), get_the_author() ); } } endif; if ( ! function_exists( 'twentythirteen_entry_date' ) ) : /** * Print HTML with date information for current post. * * Create your own twentythirteen_entry_date() to override in a child theme. * * @since Twenty Thirteen 1.0 * * @param boolean $echo (optional) Whether to echo the date. Default true. * @return string The HTML-formatted post date. */ function creator_entry_date( $echo = true ) { if ( has_post_format( array( 'chat', 'status' ) ) ) $format_prefix = _x( '%1$s on %2$s', '1: post format name. 2: date', 'twentythirteen' ); else $format_prefix = '%2$s'; $date = sprintf( ' ', esc_url( get_permalink() ), esc_attr( sprintf( __( 'Permalink to %s', 'twentythirteen' ), the_title_attribute( 'echo=0' ) ) ), esc_attr( get_the_date( 'c' ) ), esc_html( sprintf( $format_prefix, get_post_format_string( get_post_format() ), get_the_date() ) ) ); if ( $echo ) echo $date; return $date; } endif; function addexif ($content) { global $post; global $coord; $postID = $post->ID; $display_exif = dess_setting('dess_display_exif'); $display_gps = dess_setting('dess_display_gps'); if ($display_exif == true) { $matches3 = array(); //$coord = array(); // Le caption //$pattern = '/

(.*?)<\/p>/'; //$pattern = '/

]*>(.*?)\<\/div>/'; // `attachment_1049` `width: 810px` `wp-caption aligncenter` //$pattern = '/
/'; // `attachment_1049` //$pattern = '/
]*>(.*?)\<\/div>/'; // `1049` $pattern = '/
]*>(.*?)\<\/div>/'; preg_match_all($pattern, $content, $matches, PREG_SET_ORDER); /* echo "matches[0][0]"; //
...
echo $matches[0][0]; echo "matches[0][1]"; // 1114 echo $matches[0][1]; echo "matches[0][2]"; // ... echo $matches[0][2]; */ // Pour tous les DIV (attachment) on cherche les for ($i = 0; $i <= (count($matches) - 1); $i++) { $pattern2 = '/]*href=\"([^\"]*)\"[^>]*>(.*)<\/a>/siU'; preg_match_all($pattern2, $matches[$i][0] , $matches2, PREG_SET_ORDER); array_push($matches3, array($matches2[0][1], $matches[$i][0])); /* echo "matches2[0][0]"; // Vautour dans le brouillard de Rémuzat echo $matches2[0][0]; echo "matches2[0][1]"; // http://macbook-pro.local/wordpress/wp-content/uploads/2017/01/2016-12-01_VautourFauve_8789.jpg echo $matches2[0][1]; echo "matches2[0][2]"; // Vautour dans le brouillard de Rémuzat echo $matches2[0][2]; */ //echo "count(matches2): " . count($matches2) . "
"; $court = $matches2[0][1]; $meta = creator_get_exif( $court ); //preprint($meta); $exif_array = img_wp_exif( $meta ); $exifs = "
" . $exif_array[0] . (($display_gps == true) ? $exif_array[2] : '') . "
"; $content = str_replace($matches[$i][0], $matches[$i][0] . $exifs, $content); $matches2 = array(); if (($meta['longitude'] != "") && ($meta['latitude'] != "")) { if ($meta['caption'] != "") $fichier = $meta['caption']; else if ($meta['title'] != "") $fichier = $meta['title']; else $fichier = end(explode("/", $court)); array_push($coord, array($meta['latitude'], $meta['longitude'], $fichier)); } } // for } // ($display_exif == true) $pattern2 = '/]*href=\"([^\"]*)\"[^>]*>(.*)<\/a>/siU'; preg_match_all($pattern2, $content , $matches4, PREG_SET_ORDER); for ($i = 0; $i <= (count($matches4) - 1); $i++) { $ancien = $matches4[$i][0]; $court = $matches4[$i][1]; // si source wordpress if (substr_count($ancien, "wordpress") > 0) { //echo "ancien: " . htmlentities($ancien) . "
"; /* $patternWP = '#wp-image-[0-9]{1,4}#'; if (preg_match($patternWP, $ancien, $matches5) === 1) { $attachment = substr($matches5[0],9); */ // si $court est déjà dans $matches3 (si l'image est déjà dans un DIV) if (in_multiarray($court, $matches3) == false) { //echo "ancien: " . htmlentities($ancien) . "
"; //echo "court: " . htmlentities($court) . "
"; $meta = creator_get_exif( $court ); $exif_array = img_wp_exif( $meta ); $exifs = "
" . $exif_array[0] . (($display_gps == true) ? $exif_array[2] : '') . "
"; $content = str_replace($matches4[$i][0], $matches4[$i][0] . $exifs, $content); if (($meta['longitude'] != "") && ($meta['latitude'] != "")) { if ($meta['caption'] != "") $fichier = $meta['caption']; else if ($meta['title'] != "") $fichier = $meta['title']; else $fichier = end(explode("/", $court)); array_push($coord, array($meta['latitude'], $meta['longitude'], $fichier)); } } // if in_multiarray } //if wordpress // si source zenphoto elseif ((substr_count($ancien, 'zenphoto') != 0) and (substr_count($ancien, 'zenphoto" . "
"; $patternZP = '/]*href=\"([^\"]*)\"[^>]*>(.*)<\/a>/siU'; preg_match($patternZP, $ancien , $matches2); $img = explode("/", $matches2[1]); $zp_image = end($img); $zp_album = prev($img); $meta = zp_query_exif( $zp_image ); $exif_array = img_wp_exif( $meta ); $exifs = "
" . $exif_array[0] . (($display_gps == true) ? $exif_array[2] : '') . "
"; $content = str_replace($matches4[$i][0], $matches4[$i][0] . $exifs, $content); if (($meta['longitude'] != "") && ($meta['latitude'] != "")) { if ($meta['caption'] != "") $fichier = $meta['caption']; else if ($meta['title'] != "") $fichier = $meta['title']; else $fichier = end(explode("/", $court)); array_push($coord, array($meta['latitude'], $meta['longitude'], $fichier)); } } // else zenphoto // Autres sources que WP et ZP elseif (substr_count($ancien, 'jpg') > 0) { echo $ancien; $meta = creator_get_exif( $court ); /* Flicker (portrait): Flicker (paysage) vautour avec branche: 1600x1066 https://www.flickr.com/photos/funnymac/24826683615/sizes/o/ https://c2.staticflickr.com/2/1544/24826683615_c42292df06_o.jpg BBCODE [url=https://flic.kr/p/DPRf6e][img]https://c1.staticflickr.com/2/1544/24826683615_558bff1744_h.jpg[/img][/url] 800x533 https://www.flickr.com/photos/funnymac/24826683615/sizes/c/ https://c2.staticflickr.com/2/1544/24826683615_3967bc60d2_c.jpg $atts['link'] = $link; $atts['small'] = $small; $atts['big'] = $big; */ //$anc = str_replace("/>", "class='aligncenter' style='width: " . (($portrait === false) ? "610" : "408") . "px;' />", $ancien) . "\r\n"; //$anc = str_replace("/>", "class='aligncenter' />", $ancien) . "\r\n"; } // else } // for //preprint ($coord); return $content; } add_action('the_content','addexif'); function img_wp_exif( $exif_array ) { /* Array ( [aperture] => 10 [credit] => [camera] => Canon EOS 5D Mark III [caption] => [created_timestamp] => 1454520944 [copyright] => [focal_length] => 118 [iso] => 800 [shutter_speed] => 1/200 [title] => Etang des Fontaines [orientation] => 1 [latitude] => 47.109745 [longitude] => 5.0787033333333 [keywords] => Array ( [0] => Etang [1] => coucher de soleil ) [latitudeRef] => N [longitudeRef] => E [altitude] => 206.5042 ) */ $exifInfo = ""; $exifGPS = ""; $geo_link = ""; // Si données GPS: if ($exif_array['aperture'] != "") { // bloc exif (avec icones) //$exifInfo = "
"; $exifInfo .= "" . date(__("F j, Y, g:i a",'CreatorThemeRes-child'),$exif_array['created_timestamp']) . ""; $exifInfo .= "" . $exif_array['camera'] . ""; $exifInfo .= "" . $exif_array['shutter_speed'] . ""; $exifInfo .= "" . $exif_array['aperture'] . ""; $exifInfo .= "" . $exif_array['iso'] . ""; $exifInfo .= ""; $exifInfo .= (($exif_array['lens'] != "") ? $exif_array['lens'] : $exif_array['focal_length']); $exifInfo .= ""; //$exifInfo .= "
"; /* // lien exif (texte) $exifInfo = ""; $exifInfo = __('The','CreatorThemeRes-child') . " " . date(__("F j, Y, g:i a",'CreatorThemeRes-child'),$exif_array['created_timestamp']); $exifInfo .= ' - ' . $exif_array['shutter_speed']; $exifInfo .= '' . __(' at ','CreatorThemeRes-child') . "f/" . $exif_array['aperture']; $exifInfo .= ' - ' .$exif_array['iso'].' ISO - '; $exifInfo .= (($exif_array['lens'] != "") ? __('Lens: ','CreatorThemeRes-child') . $exif_array['lens'] : __('Focal: ','CreatorThemeRes-child') . $exif_array['focal_length'] . "mm"); */ } // Si données GPS: if ($exif_array['latitude'] != "") { // lien lat/long/alt (avec icones) //$exifGPS = "
"; $exifGPS .= "" . $exif_array['latitude'] . ""; $exifGPS .= "" . $exif_array['longitude'] . ""; $exifGPS .= "" . $exif_array['altitude'] . ""; //$exifGPS .= "
"; // lien lat/long/alt (texte) //$exifGPS .= __('Latitude: ','CreatorThemeRes-child') . $exif_array['latitude'] . __(' Longitude: ','CreatorThemeRes-child') . $exif_array['longitude'] . __(' Altitude: ','CreatorThemeRes-child') . number_format($exif_array['altitude']) . 'm'; //lien vers Googlemaps (globe) $geo_link = ''; //$geo_link .= ''; $geo_link .= ''; $geo_link .= ''; } return array($exifInfo, $exifGPS, $geo_link); } function creator_get_exif( $file ) { /* if ( ! file_exists( $file ) ) { echo "pas de fichier"; return false; } */ list( , , $sourceImageType ) = getimagesize( $file ); /* * EXIF contains a bunch of data we'll probably never need formatted in ways * that are difficult to use. We'll normalize it and just extract the fields * that are likely to be useful. Fractions and numbers are converted to * floats, dates to unix timestamps, and everything else to strings. */ $meta = array( 'aperture' => 0, 'credit' => '', 'camera' => '', 'caption' => '', 'created_timestamp' => 0, 'copyright' => '', 'focal_length' => 0, 'iso' => 0, 'shutter_speed' => 0, 'title' => '', 'orientation' => 0, 'latitude' => 0, 'longitude' => 0, 'latitude' => 0, 'altitude' => 0, 'lens' => '', 'keywords' => array(), ); $iptc = array(); /* * Read IPTC first, since it might contain data not available in exif such * as caption, description etc. */ if ( is_callable( 'iptcparse' ) ) { getimagesize( $file, $info ); if ( ! empty( $info['APP13'] ) ) { $iptc = iptcparse( $info['APP13'] ); // Headline, "A brief synopsis of the caption." if ( ! empty( $iptc['2#105'][0] ) ) { $meta['title'] = trim( $iptc['2#105'][0] ); /* * Title, "Many use the Title field to store the filename of the image, * though the field may be used in many ways." */ } elseif ( ! empty( $iptc['2#005'][0] ) ) { $meta['title'] = trim( $iptc['2#005'][0] ); } if ( ! empty( $iptc['2#120'][0] ) ) { // description / legacy caption $caption = trim( $iptc['2#120'][0] ); mbstring_binary_safe_encoding(); $caption_length = strlen( $caption ); reset_mbstring_encoding(); if ( empty( $meta['title'] ) && $caption_length < 80 ) { // Assume the title is stored in 2:120 if it's short. $meta['title'] = $caption; } $meta['caption'] = $caption; } if ( ! empty( $iptc['2#110'][0] ) ) // credit $meta['credit'] = trim( $iptc['2#110'][0] ); elseif ( ! empty( $iptc['2#080'][0] ) ) // creator / legacy byline $meta['credit'] = trim( $iptc['2#080'][0] ); if ( ! empty( $iptc['2#055'][0] ) && ! empty( $iptc['2#060'][0] ) ) // created date and time $meta['created_timestamp'] = strtotime( $iptc['2#055'][0] . ' ' . $iptc['2#060'][0] ); if ( ! empty( $iptc['2#116'][0] ) ) // copyright $meta['copyright'] = trim( $iptc['2#116'][0] ); if ( ! empty( $iptc['2#025'][0] ) ) { // keywords array $meta['keywords'] = array_values( $iptc['2#025'] ); } } } //if ( is_callable( 'exif_read_data' ) && in_array( $sourceImageType, apply_filters( 'wp_read_image_metadata_types', array( IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM ) ) ) ) { if ( is_callable( 'exif_read_data' )) { $exif = @exif_read_data( $file ); //preprint($exif); if ( ! empty( $exif['ImageDescription'] ) ) { mbstring_binary_safe_encoding(); $description_length = strlen( $exif['ImageDescription'] ); reset_mbstring_encoding(); if ( empty( $meta['title'] ) && $description_length < 80 ) { // Assume the title is stored in ImageDescription $meta['title'] = trim( $exif['ImageDescription'] ); } if ( empty( $meta['caption'] ) && ! empty( $exif['COMPUTED']['UserComment'] ) ) { $meta['caption'] = trim( $exif['COMPUTED']['UserComment'] ); } if ( empty( $meta['caption'] ) ) { $meta['caption'] = trim( $exif['ImageDescription'] ); } } elseif ( empty( $meta['caption'] ) && ! empty( $exif['Comments'] ) ) { $meta['caption'] = trim( $exif['Comments'] ); } if ( empty( $meta['credit'] ) ) { if ( ! empty( $exif['Artist'] ) ) { $meta['credit'] = trim( $exif['Artist'] ); } elseif ( ! empty($exif['Author'] ) ) { $meta['credit'] = trim( $exif['Author'] ); } } if ( empty( $meta['copyright'] ) && ! empty( $exif['Copyright'] ) ) { $meta['copyright'] = trim( $exif['Copyright'] ); } if ( ! empty( $exif['FNumber'] ) ) { $meta['aperture'] = "f/" . round( geo_frac2dec( $exif['FNumber'] ), 2 ); } if ( ! empty( $exif['Model'] ) ) { $meta['camera'] = trim( $exif['Model'] ); } if ( empty( $meta['created_timestamp'] ) && ! empty( $exif['DateTimeDigitized'] ) ) { //$meta['created_timestamp'] = wp_exif_date2ts( $exif['DateTimeDigitized'] ); $meta['created_timestamp'] = $exif['DateTimeDigitized']; } if ( ! empty( $exif['FocalLength'] ) ) { $meta['focal_length'] = (string) geo_frac2dec( $exif['FocalLength'] ) . " mm"; } if ( ! empty( $exif['ISOSpeedRatings'] ) ) { $meta['iso'] = is_array( $exif['ISOSpeedRatings'] ) ? reset( $exif['ISOSpeedRatings'] ) : $exif['ISOSpeedRatings']; $meta['iso'] = trim( $meta['iso'] ); } if ( ! empty( $exif['ExposureTime'] ) ) { //$meta['shutter_speed'] = (string) wp_exif_frac2dec( $exif['ExposureTime'] ); $meta['shutter_speed'] = $exif['ExposureTime']; } if ( ! empty( $exif['Orientation'] ) ) { $meta['orientation'] = $exif['Orientation']; } if ( ! empty( $exif['GPSLatitude'] ) ) { $lat = gps($exif['GPSLatitude'], trim( $exif['GPSLatitudeRef'] )); $meta['latitude'] = number_format($lat, 6); } if ( ! empty( $exif['GPSLongitude'] ) ) { $long = gps($exif['GPSLongitude'], trim( $exif['GPSLongitudeRef'] )); $meta['longitude'] = number_format($long, 6); } /* if ( ! empty( $exif['GPSLatitudeRef'] ) ) { $meta['latitudeRef'] = trim( $exif['GPSLatitudeRef'] ); } if ( ! empty( $exif['GPSLongitudeRef'] ) ) { $meta['longitudeRef'] = trim( $exif['GPSLongitudeRef'] ); } */ if ( ! empty( $exif['GPSAltitude'] ) ) { $meta['altitude'] = number_format(geo_frac2dec($exif['GPSAltitude'])); } if ( ! empty( $exif['UndefinedTag:0xA434'] ) ) { $meta['lens'] = trim($exif['UndefinedTag:0xA434']); } // [UndefinedTag:0xA434] => 10.0-22.0 mm // [UndefinedTag:0xA434] => EF500mm f/4L IS USM +1.4x } foreach ( array( 'title', 'caption', 'credit', 'copyright', 'camera', 'iso' ) as $key ) { if ( $meta[ $key ] && ! seems_utf8( $meta[ $key ] ) ) { $meta[ $key ] = utf8_encode( $meta[ $key ] ); } } foreach ( $meta['keywords'] as $key => $keyword ) { if ( ! seems_utf8( $keyword ) ) { $meta['keywords'][ $key ] = utf8_encode( $keyword ); } } //$meta = wp_kses_post_deep( $meta ); /** * Filters the array of meta data read from an image's exif data. * * @since 2.5.0 * @since 4.4.0 The `$iptc` parameter was added. * * @param array $meta Image meta data. * @param string $file Path to image file. * @param int $sourceImageType Type of image. * @param array $iptc IPTC data. */ //return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType, $iptc ); return $meta; } function geo_single_fracs2dec($fracs) { return geo_frac2dec($fracs[0]) + geo_frac2dec($fracs[1]) / 60 + geo_frac2dec($fracs[2]) / 3600; } function geo_frac2dec($str) { @list( $n, $d ) = explode( '/', $str ); if ( !empty($d) ) return $n / $d; return $str; } function gps($coordinate, $hemisphere) { for ($i = 0; $i < 3; $i++) { $part = explode('/', $coordinate[$i]); if (count($part) == 1) { $coordinate[$i] = $part[0]; } else if (count($part) == 2) { $coordinate[$i] = floatval($part[0])/floatval($part[1]); } else { $coordinate[$i] = 0; } } list($degrees, $minutes, $seconds) = $coordinate; $sign = ($hemisphere == 'W' || $hemisphere == 'S') ? -1 : 1; return $sign * ($degrees + $minutes/60 + $seconds/3600); } remove_shortcode('gallery', 'gallery_shortcode'); add_shortcode('gallery', 'creator_gallery_shortcode'); /** * Builds the Gallery shortcode output. * * This implements the functionality of the Gallery Shortcode for displaying * WordPress images on a post. * * @since 2.5.0 * * @staticvar int $instance * * @param array $attr { * Attributes of the gallery shortcode. * * @type string $order Order of the images in the gallery. Default 'ASC'. Accepts 'ASC', 'DESC'. * @type string $orderby The field to use when ordering the images. Default 'menu_order ID'. * Accepts any valid SQL ORDERBY statement. * @type int $id Post ID. * @type string $itemtag HTML tag to use for each image in the gallery. * Default 'dl', or 'figure' when the theme registers HTML5 gallery support. * @type string $icontag HTML tag to use for each image's icon. * Default 'dt', or 'div' when the theme registers HTML5 gallery support. * @type string $captiontag HTML tag to use for each image's caption. * Default 'dd', or 'figcaption' when the theme registers HTML5 gallery support. * @type int $columns Number of columns of images to display. Default 3. * @type string|array $size Size of the images to display. Accepts any valid image size, or an array of width * and height values in pixels (in that order). Default 'thumbnail'. * @type string $ids A comma-separated list of IDs of attachments to display. Default empty. * @type string $include A comma-separated list of IDs of attachments to include. Default empty. * @type string $exclude A comma-separated list of IDs of attachments to exclude. Default empty. * @type string $link What to link each image to. Default empty (links to the attachment page). * Accepts 'file', 'none'. * } * @return string HTML content to display gallery. */ function creator_gallery_shortcode( $attr ) { $post = get_post(); static $instance = 0; $instance++; if ( ! empty( $attr['ids'] ) ) { // 'ids' is explicitly ordered, unless you specify otherwise. if ( empty( $attr['orderby'] ) ) { $attr['orderby'] = 'post__in'; } $attr['include'] = $attr['ids']; } /** * Filters the default gallery shortcode output. * * If the filtered output isn't empty, it will be used instead of generating * the default gallery template. * * @since 2.5.0 * @since 4.2.0 The `$instance` parameter was added. * * @see gallery_shortcode() * * @param string $output The gallery output. Default empty. * @param array $attr Attributes of the gallery shortcode. * @param int $instance Unique numeric ID of this gallery shortcode instance. */ $output = apply_filters( 'post_gallery', '', $attr, $instance ); if ( $output != '' ) { return $output; } $html5 = current_theme_supports( 'html5', 'gallery' ); $atts = shortcode_atts( array( 'order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post ? $post->ID : 0, 'itemtag' => $html5 ? 'figure' : 'dl', 'icontag' => $html5 ? 'div' : 'dt', 'captiontag' => $html5 ? 'figcaption' : 'dd', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => '', 'link' => '' ), $attr, 'gallery' ); $id = intval( $atts['id'] ); if ( ! empty( $atts['include'] ) ) { $_attachments = get_posts( array( 'include' => $atts['include'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) ); $attachments = array(); foreach ( $_attachments as $key => $val ) { $attachments[$val->ID] = $_attachments[$key]; } } elseif ( ! empty( $atts['exclude'] ) ) { $attachments = get_children( array( 'post_parent' => $id, 'exclude' => $atts['exclude'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) ); } else { $attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) ); } if ( empty( $attachments ) ) { return ''; } if ( is_feed() ) { $output = "\n"; foreach ( $attachments as $att_id => $attachment ) { $output .= wp_get_attachment_link( $att_id, $atts['size'], true ) . "\n"; } return $output; } $itemtag = tag_escape( $atts['itemtag'] ); $captiontag = tag_escape( $atts['captiontag'] ); $icontag = tag_escape( $atts['icontag'] ); $valid_tags = wp_kses_allowed_html( 'post' ); if ( ! isset( $valid_tags[ $itemtag ] ) ) { $itemtag = 'dl'; } if ( ! isset( $valid_tags[ $captiontag ] ) ) { $captiontag = 'dd'; } if ( ! isset( $valid_tags[ $icontag ] ) ) { $icontag = 'dt'; } $columns = intval( $atts['columns'] ); $itemwidth = $columns > 0 ? floor(100/$columns) : 100; $float = is_rtl() ? 'right' : 'left'; $selector = "gallery-{$instance}"; $gallery_style = ''; /** * Filters whether to print default gallery styles. * * @since 3.1.0 * * @param bool $print Whether to print default gallery styles. * Defaults to false if the theme supports HTML5 galleries. * Otherwise, defaults to true. */ if ( apply_filters( 'use_default_gallery_style', ! $html5 ) ) { $gallery_style = " \n\t\t"; } $size_class = sanitize_html_class( $atts['size'] ); $gallery_div = "\n"; return $output; } //http://cssmary.com/wordpress/customizer-api-child-theme/ function childtheme_customize_register( $wp_customize ) { // remove settings $remove_socials = array('google-plus','instagram','pinterest','linkedin'); for($i=0;$iremove_setting( 'dess_'.$remove_socials[$i] ); $wp_customize->remove_control( 'dess_'.$remove_socials[$i] ); } $wp_customize->remove_setting( 'dess_hoursup' ); $wp_customize->remove_control( 'dess_hoursup' ); $wp_customize->remove_setting( 'dess_tel' ); $wp_customize->remove_control( 'dess_tel' ); // add settings $add_socials = array('500px','flickr','rss','mail'); for($i=0;$iadd_setting('dess_'.$add_socials[$i], array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', 'sanitize_callback' => 'dess_sanitize_url', )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'dess_'.$add_socials[$i], array( 'settings' => 'dess_'.$add_socials[$i], 'label' => $name.' URL', 'section' => 'sm_section', 'type' => 'text', ))); } $wp_customize->get_setting( 'dess_rss' )->default = get_bloginfo('rss2_url'); // new section $wp_customize->add_section('settings_section', array( 'title' => __('Settings','creator'), 'capability' => 'edit_theme_options', 'description' => __('Theme settings','CreatorThemeRes-child') ) ); // new options $wp_customize->add_setting('dess_zenphoto', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', 'sanitize_callback' => 'dess_sanitize_html', )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'dess_zenphoto', array( 'settings' => 'dess_zenphoto', 'label' => __('Zenphoto path','CreatorThemeRes-child'), 'section' => 'settings_section', 'type' => 'text', ))); $wp_customize->add_setting('dess_social_size', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', 'sanitize_callback' => 'dess_sanitize_html', )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'dess_social_size', array( 'settings' => 'dess_social_size', 'label' => __('Socials icons size (16 or 32px)','CreatorThemeRes-child'), 'section' => 'settings_section', 'type' => 'text', ))); $wp_customize->add_setting('dess_lightbox_select', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', 'sanitize_callback' => 'dess_sanitize_html', )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'dess_lightbox_select', array( 'settings' => 'dess_lightbox_select', 'label' => __('Lightbox selector (class="xxx")','CreatorThemeRes-child'), 'section' => 'settings_section', 'type' => 'text', ))); $wp_customize->add_setting( 'dess_lightbox_choice', array( 'default' => 'b', ) ); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'dess_lightbox_choice', array( 'label' => __('Choice of lightbox','CreatorThemeRes-child'), 'section' => 'settings_section', 'settings' => 'dess_lightbox_choice', 'type' => 'radio', 'choices' => array( 'a' => 'Meow box', 'b' => 'Colorbox', 'c' => 'Featherlight', ), ))); $wp_customize->add_setting( 'dess_display_exif', array( 'default' => 'trlue', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'dess_display_exif', array( 'settings' => 'dess_display_exif', 'label' => __('Display EXIFs','CreatorThemeRes-child'), 'section' => 'settings_section', 'type' => 'checkbox', ) ); $wp_customize->add_setting( 'dess_display_gps', array( 'default' => 'false', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'dess_display_gps', array( 'settings' => 'dess_display_gps', 'label' => __('Display Geo datas','CreatorThemeRes-child'), 'section' => 'settings_section', 'type' => 'checkbox', ) ); $wp_customize->add_setting( 'dess_display_meta', array( 'default' => 'false', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', ) ); $wp_customize->add_control( 'dess_display_meta', array( 'settings' => 'dess_display_meta', 'label' => __('Display meta (single)','CreatorThemeRes-child'), 'section' => 'settings_section', 'type' => 'checkbox', ) ); } add_action( 'customize_register', 'childtheme_customize_register', 12); /* function choice_a_callback( $control ) { if ( $control->manager->get_setting('dess_lightbox_choice')->value() == 'a' ) { return true; } else { return false; } } function choice_b_callback( $control ) { if ( $control->manager->get_setting('dess_lightbox_choice')->value() == 'b' ) { return true; } else { return false; } } function choice_c_callback( $control ) { if ( $control->manager->get_setting('dess_lightbox_choice')->value() == 'c' ) { return true; } else { return false; } } */ function show_bookmark_list(){ ?>
    '

    ', 'title_after' => '

    ', ); wp_list_bookmarks( $args ); ?>
get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ), 'caption' => $attachment->post_excerpt, 'description' => $attachment->post_content, 'href' => get_permalink( $attachment->ID ), 'src' => $attachment->guid, 'title' => $attachment->post_title ); } /*** INUTILE ***/ /** * Ajoute les données GPS aux métadata lors de l'importation du média */ function add_geo_exif($meta,$file,$sourceImageType) { $exif = @exif_read_data( $file ); if (!empty($exif['GPSLatitude'])) $meta['latitude'] = $exif['GPSLatitude'] ; if (!empty($exif['GPSLatitudeRef'])) $meta['latitude_ref'] = trim( $exif['GPSLatitudeRef'] ); if (!empty($exif['GPSLongitude'])) $meta['longitude'] = $exif['GPSLongitude'] ; if (!empty($exif['GPSLongitudeRef'])) $meta['longitude_ref'] = trim( $exif['GPSLongitudeRef'] ); return $meta; } add_filter('wp_read_image_metadata', 'add_geo_exif','',3); /*** A SUPPRIMER (CI-DESSOUS) ***/ function exifme($content) { /*ID du post*/ global $post; $postID = $post->ID; if (function_exists( ' wr2x_init' ) ) $pattern = '/]* src=\"([^\"]*)\"[^>]*>/Ui'; // sans retina else $pattern = '/]*src=\"?([^\"]*)\"?([^>]*alt=\"?([^\"]*)\"?)?[^>]*>/Ui'; //preg_match_all($pattern, $content , $matches, PREG_SET_ORDER); // 2 (do_shortcode) renard wp / gp zp $pattern2 = '/]*href=\"([^\"]*)\"[^>]*>(.*)<\/a>/siU'; preg_match_all($pattern2, $content , $matches, PREG_SET_ORDER); // 8 (do_shortcode) 2 gp / 2 renard / 4 gp // post: gp (shortcode) / renard (wordpress) / gp (zenphoto) / gp (zenphoto) //preprint($matches); for ($i = 0; $i <= (count($matches) - 1); $i++) { $ancien = $matches[$i][0]; $court = $matches[$i][1]; // source wordpress if (substr_count($ancien, 'wordpress') != 0) { $patternWP = '#wp-image-[0-9]{1,4}#'; if (preg_match($patternWP, $ancien, $matches2) === 1) { $attachment = substr($matches2[0],9); //echo $court; echo $ancien; $meta = creator_get_exif( $court ); //preprint($meta); //$exif_array = img_wp_exif( $meta ); //echo $exif_array[0]; //preprint($exif_array); } // preg_match } // if wordpress // source zenphoto elseif ((substr_count($ancien, 'zenphoto') != 0) and (substr_count($ancien, ' Flicker (paysage) vautour avec branche: 1600x1066 https://www.flickr.com/photos/funnymac/24826683615/sizes/o/ https://c2.staticflickr.com/2/1544/24826683615_c42292df06_o.jpg BBCODE [url=https://flic.kr/p/DPRf6e][img]https://c1.staticflickr.com/2/1544/24826683615_558bff1744_h.jpg[/img][/url] 800x533 https://www.flickr.com/photos/funnymac/24826683615/sizes/c/ https://c2.staticflickr.com/2/1544/24826683615_3967bc60d2_c.jpg $atts['link'] = $link; $atts['small'] = $small; $atts['big'] = $big; */ //$anc = str_replace("/>", "class='aligncenter' style='width: " . (($portrait === false) ? "610" : "408") . "px;' />", $ancien) . "\r\n"; $anc = str_replace("/>", "class='aligncenter' />", $ancien) . "\r\n"; } // else // commun à WP et ZP $exif_array = img_wp_exif( $meta ); //preprint($exif_array); echo $exif_array[0]; } // for /*-----------------*/ return $content; /*-----------------*/ } //add_action('the_content','exifme'); /** * Create a definition list containing EXIF data of featured image (if exists) * * @param string $post ID * @return echo definition list */ function pa_the_post_thumbnail_exif_data($content) { // if $postID not specified, then get global post and assign ID if (!$postID) { global $post; $postID = $post->ID; } if (has_post_thumbnail($postID)) { // get the meta data from the featured image $postThumbnailID = get_post_thumbnail_id( $postID ); $photoMeta = wp_get_attachment_metadata( $postThumbnailID ); // if the shutter speed is not equal to 0 if ($photoMeta['image_meta']['shutter_speed'] != 0) { // Convert the shutter speed to a fraction if ((1 / $photoMeta['image_meta']['shutter_speed']) > 1) { if ((number_format((1 / $photoMeta['image_meta']['shutter_speed']), 1)) == 1.3 or number_format((1 / $photoMeta['image_meta']['shutter_speed']), 1) == 1.5 or number_format((1 / $photoMeta['image_meta']['shutter_speed']), 1) == 1.6 or number_format((1 / $photoMeta['image_meta']['shutter_speed']), 1) == 2.5) { $photoShutterSpeed = "1/" . number_format((1 / $photoMeta['image_meta']['shutter_speed']), 1, '.', '') . " second"; } else { $photoShutterSpeed = "1/" . number_format((1 / $photoMeta['image_meta']['shutter_speed']), 0, '.', '') . " second"; } } else { $photoShutterSpeed = $photoMeta['image_meta']['shutter_speed'] . " seconds"; } // print our definition list ?>
Date Taken
Camera
Focal Length
mm
Aperture
f/
ISO
Shutter Speed
EXIF data not found

'; } // if no featured image, echo error message } else { echo '

Featured image not found

'; } } /* function wp_exif_frac2dec($str) { @list( $n, $d ) = explode( '/', $str ); if ( !empty($d) ) return $n / $d; return $str; } function wp_exif_date2ts($str) { @list( $date, $time ) = explode( ' ', trim($str) ); @list( $y, $m, $d ) = explode( ':', $date ); return strtotime( "{$y}-{$m}-{$d} {$time}" ); } */ ?>