1071 lines
35 KiB
PHP
1071 lines
35 KiB
PHP
<?php load_theme_textdomain('twentyten-child', get_template_directory() . '-child/languages'); ?>
|
||
<?php
|
||
$serial = "89f6e92540a8a80bd28cc2630c0ae022";
|
||
update_option( 'wr2x_pro', array( 'subscr_id' => $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_filter( 'pre_option_link_manager_enabled', '__return_true' );
|
||
add_filter('sanitize_file_name', 'remove_accents' );
|
||
|
||
// Set Plugins and Themes to Update Automatically
|
||
add_filter( 'auto_update_plugin', '__return_true' );
|
||
add_filter( 'auto_update_theme', '__return_true' );
|
||
|
||
// à l'initialisation de l'administration
|
||
// on informe WordPress des options de notre thème
|
||
|
||
add_action( 'admin_init', 'myThemeRegisterSettings' );
|
||
|
||
function myThemeRegisterSettings( ) {
|
||
register_setting( 'twentyten-child', 'zenphoto_url' ); // couleur de fond
|
||
register_setting( 'twentyten-child', 'img_size' ); // couleur du texte
|
||
register_setting( 'twentyten-child', 'guestbook_comment' ); // commentaires
|
||
}
|
||
|
||
// la fonction myThemeAdminMenu( ) sera exécutée
|
||
// quand WordPress mettra en place le menu d'admin
|
||
|
||
add_action( 'admin_menu', 'myThemeAdminMenu' );
|
||
|
||
function myThemeAdminMenu( ) {
|
||
add_menu_page(
|
||
'Options de Twentyten Child', // le titre de la page
|
||
'Twentyten Child', // le nom de la page dans le menu d'admin
|
||
'administrator', // le rôle d'utilisateur requis pour voir cette page
|
||
'my-theme-page', // un identifiant unique de la page
|
||
'myThemeSettingsPage' // le nom d'une fonction qui affichera la page
|
||
);
|
||
}
|
||
|
||
|
||
// La page des settings
|
||
|
||
function myThemeSettingsPage( ) {
|
||
?>
|
||
<div class="wrap">
|
||
<h2>Options de mon thème</h2>
|
||
|
||
<form method="post" action="options.php">
|
||
<?php
|
||
// cette fonction ajoute plusieurs champs cachés au formulaire
|
||
// pour vous faciliter le travail.
|
||
// elle prend en paramètre le nom du groupe d'options
|
||
// que nous avons défini plus haut.
|
||
|
||
settings_fields( 'twentyten-child' );
|
||
?>
|
||
|
||
<table class="form-table">
|
||
<tr valign="top">
|
||
<th scope="row"><label for="zenphoto_url">URL de Zenphoto</label></th>
|
||
<td><input type="text" id="zenphoto_url" name="zenphoto_url" size="30" value="<?php echo get_option( 'zenphoto_url' ); ?>" /></td>
|
||
</tr>
|
||
|
||
<tr valign="top">
|
||
<th scope="row"><label for="img_size">Taille des images</label></th>
|
||
<td><input type="text" id="img_size" name="img_size" class="small-text" value="<?php echo get_option( 'img_size' ); ?>" /></td>
|
||
</tr>
|
||
|
||
<tr valign="top">
|
||
<th scope="row"><label for="guestbook_comment">Répondre aux commentaires du livre d'or</label></th>
|
||
<td><input type="checkbox" id="guestbook_comment" name="guestbook_comment" value="1" <?php checked( '1', get_option( 'guestbook_comment' ) ); ?> /> <?php echo get_option( 'guestbook_comment' ); ?></td>
|
||
</tr>
|
||
</table>
|
||
<p class="submit">
|
||
<input type="submit" class="button-primary" value="Mettre à jour" />
|
||
</p>
|
||
</form>
|
||
</div>
|
||
<?php
|
||
}
|
||
|
||
|
||
/* Affichage des array() */
|
||
|
||
function preprint($s, $return=false) {
|
||
$x = "<pre>";
|
||
$x .= print_r($s, 1);
|
||
$x .= "</pre>";
|
||
if ($return) return $x;
|
||
else print $x;
|
||
}
|
||
|
||
|
||
/*** Ajout d'un bouton ZP dans l'éditeur visuel (tinymce) ***/
|
||
|
||
add_action('init','add_buttons');
|
||
function add_buttons(){
|
||
if(current_user_can('edit_posts') && current_user_can('edit_pages')){
|
||
add_filter('mce_external_plugins','add_plugins');
|
||
add_filter('mce_buttons','register_buttons');
|
||
}
|
||
}
|
||
|
||
function add_plugins($plugins){
|
||
$plugins['zp'] = get_bloginfo('stylesheet_directory').'/js/zenphoto.js';
|
||
return $plugins;
|
||
}
|
||
function register_buttons($buttons){
|
||
array_push($buttons, 'zp');
|
||
return $buttons;
|
||
}
|
||
/*** /ajout bouton ZP dans l'editeur ***/
|
||
|
||
|
||
/* Shorcode Zenphoto
|
||
*/
|
||
|
||
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"]
|
||
//taille des photos dans Worpress, theme Twenty Ten Child : 610x406
|
||
|
||
$host = (($_SERVER['HTTPS'] != "") ? "https" : "http") . '://' . $_SERVER['HTTP_HOST'] . '/zenphoto/';
|
||
|
||
$zenphoto_url2 = get_option( 'zenphoto_url' );
|
||
//echo $zenphoto_url2 . "<br>";
|
||
//preprint($zenphoto_url2);
|
||
//echo substr_count($zenphoto_url2, "https");
|
||
//echo $_SERVER['HTTPS'];
|
||
|
||
if (substr_count($zenphoto_url2, "https") == 1) {
|
||
//echo "toto";
|
||
$zenphoto_url = (($_SERVER['HTTPS'] != "") ? substr_replace($zenphoto_url2, 'https', 0, 4) : $zenphoto_url2);
|
||
}
|
||
$zenphoto_url = $host;
|
||
//echo $zenphoto_url;
|
||
|
||
$size = get_option( 'img_size' );
|
||
$folder = false;
|
||
$zenphoto_img = "";
|
||
//preprint($atts);
|
||
$a = $atts['image'];
|
||
$b = zp_query($a); // ligne 808
|
||
|
||
if (isset($atts['folder'])) {
|
||
if ($atts['folder'] == "true") $folder = true;
|
||
}
|
||
|
||
$img = substr($atts['image'], 0, strlen($atts['image']) - 4);
|
||
|
||
$filename = $zenphoto_url . 'cache/' . $atts['album'] . '/' . urlencode($img) . '_' . $size . '_watermark.jpg';
|
||
$zp_size = getimagesize(htmlentities($filename));
|
||
|
||
//if ($folder == false) $zenphoto_link = '<a rel="lightbox" href="' . $zenphoto_url . 'albums/' . $atts['album'] . '/' . $atts['image'] . '">';
|
||
if ($folder == false) $zenphoto_link = '<a data-rel="lightbox-0" href="' . $zenphoto_url . 'albums/' . $atts['album'] . '/' . $atts['image'] . '">';
|
||
else $zenphoto_link = '<a href="' . $zenphoto_url . $atts['album'] . '">';
|
||
|
||
$zenphoto_img .= $zenphoto_link;
|
||
$zenphoto_img .= '<picture data-picture data-alt="">
|
||
<!--[if IE 9]><video style="display: none;"><![endif]-->
|
||
<source class="image_standard" srcset="' . $zenphoto_url . 'cache/' . $atts['album'] . '/' . $img . '_' . $size . '_watermark.jpg, ' . $zenphoto_url . 'cache/' . $atts['album'] . '/' . $img . '_' . ($size * 2) . '_watermark.jpg 2x">
|
||
<source class="image_medium" srcset="" media="(max-width: 767px)">
|
||
<source class="image_small" srcset="" media="(max-width: 767px)">
|
||
<!--[if IE 9]></video><![endif]-->
|
||
<img class="aligncenter" srcset="' . $zenphoto_url . 'cache/' . $atts['album'] . '/' . $img . '_' . $size . '_watermark.jpg" ' . $zp_size[3] . 'alt="' . $img . '" />
|
||
</picture>';
|
||
$zenphoto_img .= '</a>';
|
||
|
||
/*
|
||
if ($b['image_meta']['description'] != "") {
|
||
$caption = "";
|
||
$caption .= '<p class="wp-caption-text aligncenter" style="width:' . $zp_size[0] . 'px">';
|
||
$caption .= $b['image_meta']['description'] . '</p>';
|
||
|
||
$zenphoto_img .= $caption;
|
||
}
|
||
*/
|
||
//echo $zenphoto_img;
|
||
return $zenphoto_img;
|
||
}
|
||
|
||
add_shortcode( 'zenphoto', 'zenphoto_handler' );
|
||
|
||
|
||
|
||
/* NON UTILISE */
|
||
|
||
function field_func($atts) {
|
||
global $post;
|
||
$name = $atts['name'];
|
||
if (empty($name)) return;
|
||
return get_post_meta($post->ID, $name, true);
|
||
}
|
||
add_shortcode('field', 'field_func');
|
||
|
||
|
||
/*
|
||
// http://wp.ruche.org/2010/12/20/utiliser-les-images-a-la-une/
|
||
add_theme_support( 'post-thumbnails', array( 'post' ) ); // Ajouter sur les articles uniquement
|
||
add_theme_support( 'post-thumbnails', array( 'page' ) ); // Ajouter sur les pages uniquement
|
||
set_post_thumbnail_size( 50, 50 ); // 50 pixels en largeur par 50 pixels en hauteur, box resize
|
||
//set_post_thumbnail_size( 50, 50, true ); // 50 pixels en largeur par 50 pixels en hauteur, mode hard crop
|
||
//add_image_size( 'miniature-archives', 200, 9999 ); // Miniatures des archives
|
||
*/
|
||
|
||
|
||
/* 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);
|
||
|
||
|
||
function favicon_link() {
|
||
echo '<link rel="shortcut icon" type="image/x-icon" href="' . get_bloginfo ( 'stylesheet_directory' ) . '/images/favicon.ico" />' . "\n";
|
||
}
|
||
|
||
add_action('wp_head', 'favicon_link');
|
||
|
||
|
||
function childtheme_iefix() { ?>
|
||
<!--[if lt IE 8]>
|
||
<link rel="stylesheet" type="text/css" href="<?php echo bloginfo('stylesheet_directory') ?>/ie.css" />
|
||
<![endif]-->
|
||
<?php }
|
||
|
||
add_action('wp_head', 'childtheme_iefix');
|
||
|
||
|
||
/* NON UTILISE */
|
||
|
||
function saveCommentMeta($comment_id) {
|
||
if (isset($_POST['city']) && !empty($_POST['city'])) {
|
||
add_comment_meta($comment_id, 'city', $_POST['city'], true);
|
||
}
|
||
if (isset($_POST['pays']) && !empty($_POST['pays'])) {
|
||
add_comment_meta($comment_id, 'pays', $_POST['pays'], true);
|
||
}
|
||
}
|
||
|
||
add_action('comment_post','saveCommentMeta');
|
||
|
||
|
||
/* NON UTILISE */
|
||
|
||
function show_bookmark_list(){ ?>
|
||
<ul>
|
||
<?php
|
||
$args = array(
|
||
'title_before' => '<h3>',
|
||
'title_after' => '</h3>',
|
||
);
|
||
wp_list_bookmarks( $args ); ?>
|
||
</ul>
|
||
<?php
|
||
}
|
||
add_shortcode('show_bookmark_list', 'show_bookmark_list');
|
||
|
||
|
||
/* NON UTILISE */
|
||
|
||
// [show_bookmark_image_list catagory_name='']
|
||
function show_bookmark_image_list($atts){
|
||
extract(shortcode_atts(array(
|
||
'catagory_name' => false
|
||
), $atts));
|
||
if ( $catagory_name == false )
|
||
$bookmarks = get_bookmarks();
|
||
else
|
||
$bookmarks = get_bookmarks("catagory_name=$catagory_name");
|
||
ob_start();
|
||
echo "<ul class='link-image-list'>";
|
||
foreach($bookmarks as $bookmark){
|
||
$cat = $bookmark->link_category;
|
||
//foreach(($bookmark->link_category) as $cat){
|
||
/*
|
||
stdClass Object (
|
||
[link_id] => 10
|
||
[link_url] => http://www.eos-numerique.com/
|
||
[link_name] => EOS-Numerique
|
||
[link_image] =>
|
||
[link_target] =>
|
||
[link_category] => 3
|
||
[link_description] => Portail EOS Canon numérique
|
||
[link_visible] => Y
|
||
[link_owner] => 1
|
||
[link_rating] => 0
|
||
[link_updated] => 0000-00-00 00:00:00
|
||
[link_rel] =>
|
||
[link_notes] =>
|
||
[link_rss] =>
|
||
)
|
||
*/
|
||
//echo "<li><a href='".esc_url($bookmark->link_url) ."'><img src='".esc_url($bookmark->link_image)."' /></a></li>";
|
||
//echo "<li><a href='".esc_url($bookmark->link_url) ."'>".$bookmark->link_name."</a></li>";
|
||
echo $cat;
|
||
//}
|
||
}
|
||
echo "</ul>";
|
||
$list = ob_get_clean();
|
||
return $list;
|
||
}
|
||
add_shortcode('show_bookmark_image_list', 'show_bookmark_image_list');
|
||
//end show_bookmark_image_list
|
||
|
||
|
||
/* Signale que le post a été mis à jour
|
||
loop-single.php:365:
|
||
*/
|
||
|
||
function twentyten_post_updated() {
|
||
$u_time = get_the_time('U');
|
||
$u_modified_time = get_the_modified_time('U');
|
||
if ($u_modified_time >= $u_time + 86400) {
|
||
printf( __( '<span class="maj"> Article updated the %1$s at %2$s </span>', 'twentyten-child'),
|
||
sprintf('%1$s', get_the_modified_time('j F Y')),
|
||
sprintf('%1$s', get_the_modified_time())
|
||
);
|
||
}
|
||
}
|
||
|
||
/* Prints HTML with meta information for the current post—date/time and author.
|
||
livre-d-or.php:23:
|
||
loop-single.php:29:
|
||
loop.php:66:
|
||
loop.php:121:
|
||
loop.php:135:
|
||
*/
|
||
|
||
function twentyten_posted_on() {
|
||
printf( __( '%1$s', 'twentyten-child' ),
|
||
sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
|
||
get_permalink(),
|
||
esc_attr( get_the_time() ),
|
||
get_the_date()
|
||
)
|
||
);
|
||
}
|
||
|
||
/* Prints HTML with meta information for the current post (category, tags and permalink).
|
||
livre-d-or.php:32:
|
||
loop-attachment.php:149:
|
||
loop-single.php:372:
|
||
*/
|
||
|
||
function twentyten_posted_in() {
|
||
// Retrieves tag list of current post, separated by commas.
|
||
$tag_list = get_the_tag_list( '', ', ' );
|
||
if ( $tag_list ) {
|
||
//$posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
|
||
$posted_in = __( 'Posted in %1$s and tagged %2$s. <a href="%3$s" title="Permalink to %4$s" rel="bookmark">Permalink</a>.', 'twentyten-child' );
|
||
} elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
|
||
$posted_in = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten-child' );
|
||
} else {
|
||
$posted_in = __( 'Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten-child' );
|
||
}
|
||
// Prints the string, replacing the placeholders.
|
||
printf(
|
||
$posted_in,
|
||
get_the_category_list( ', ' ),
|
||
$tag_list,
|
||
get_permalink(),
|
||
the_title_attribute( 'echo=0' )
|
||
);
|
||
}
|
||
|
||
|
||
/* NON UTILISE */
|
||
|
||
function thirtyten_excerpt_more($more){
|
||
return ' … <a href="'. get_permalink() . '">' . __('finish reading '.get_the_title() .'', 'twentyten-child') . '</a>';
|
||
}
|
||
|
||
remove_filter( 'excerpt_more', 'twentyten_excerpt_more' );
|
||
add_filter ('excerpt_more', 'thirtyten_excerpt_more' );
|
||
|
||
|
||
/* Messages du livre d'or
|
||
livre-comments.php:54
|
||
*/
|
||
|
||
function twentyten_comment_guestbook( $comment, $args, $depth ) {
|
||
$GLOBALS['comment'] = $comment;
|
||
// hack 'city'
|
||
$city = htmlspecialchars(ucwords(get_comment_meta($comment->comment_ID,'city',true)));
|
||
$pays = htmlentities(get_comment_meta($comment->comment_ID,'pays',true));
|
||
$pays = str_replace('_',' ',$pays);
|
||
if (($city != "") and ($pays != "")) $a = "(" . $city . ", " . $pays . ")";
|
||
if (($city != "") and ($pays == "")) $a = "(" . $city . ")";
|
||
if (($city == "") and ($pays != "")) $a = "(" . $pays . ")";
|
||
if (($city == "") and ($pays == "")) $a = "";
|
||
|
||
switch ( $comment->comment_type ) :
|
||
case '' :
|
||
?>
|
||
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
|
||
<div id="comment-<?php comment_ID(); ?>">
|
||
<div class="comment-author vcard">
|
||
<?php echo get_avatar( $comment, 40 ); ?>
|
||
<?php //printf( __( '%s <span class="says">says:</span>', 'twentyten-child' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
|
||
<?php printf( __( '%1$s %2$s<span class="says"> says:</span>', 'twentyten-child' ), sprintf( '<cite class="fn">%1$s</cite>', get_comment_author_link() ), sprintf($a) ); ?>
|
||
</div><!-- .comment-author .vcard -->
|
||
<?php if ( $comment->comment_approved == '0' ) : ?>
|
||
<em><?php _e( 'Your comment is awaiting moderation.', 'twentyten-child' ); ?></em>
|
||
<br />
|
||
<?php endif; ?>
|
||
|
||
<div class="comment-body"><?php comment_text(); ?></div>
|
||
<div class="comment-meta commentmetadata-guestbook"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
|
||
<?php
|
||
/* translators: 1: date, 2: time */
|
||
printf( __( '%1$s at %2$s', 'twentyten-child' ), get_comment_date(), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'twentyten-child' ), ' ' );
|
||
?>
|
||
|
||
|
||
</div><!-- .comment-meta .commentmetadata -->
|
||
|
||
<?php
|
||
if (get_option( 'guestbook_comment' ) == true) {
|
||
?>
|
||
<div class="reply">
|
||
<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
|
||
</div><!-- .reply -->
|
||
|
||
<?php
|
||
}
|
||
?>
|
||
|
||
</div><!-- #comment-## -->
|
||
|
||
<?php
|
||
break;
|
||
case 'pingback' :
|
||
case 'trackback' :
|
||
?>
|
||
<li class="post pingback">
|
||
<p><?php _e( 'Pingback:', 'twentyten-child' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __('(Edit)', 'twentyten-child'), ' ' ); ?></p>
|
||
<?php
|
||
break;
|
||
endswitch;
|
||
}
|
||
|
||
|
||
/* Returns the name of one random file from within a directory
|
||
livre-d-or.php:39:
|
||
*/
|
||
|
||
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];
|
||
}
|
||
|
||
/*
|
||
loop-single.php:30
|
||
*/
|
||
|
||
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", 'twentyten-child');
|
||
elseif ($delta == 2) $text = __("the day before yesterday", 'twentyten-child');
|
||
elseif ($delta == 3) $text = __("two days ago", 'twentyten-child');
|
||
elseif (($delta > 3) and ($delta <= 7)) $text = sprintf( __('%1$s days ago', 'twentyten-child'), $delta );
|
||
elseif (($delta > 7) and ($delta <= 14)) {
|
||
$nb = round ($delta / 7);
|
||
if ($nb < 2) $text = sprintf( __('%1$s week ago', 'twentyten-child'), $nb );
|
||
else $text = sprintf( __('%1$s weeks ago', 'twentyten-child'), $nb );
|
||
}
|
||
else $text = get_the_date();
|
||
|
||
printf( __( '%1$s', 'twentyten-child' ),
|
||
sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">'.$text.'</span></a>',
|
||
get_permalink(),
|
||
esc_attr( get_the_date() . ' ' . get_the_time() )
|
||
)
|
||
);
|
||
}
|
||
|
||
/*
|
||
function exif_get_float($value) {
|
||
$pos = strpos($value, '/');
|
||
if ($pos === false) return (float) $value;
|
||
$a = (float) substr($value, 0, $pos);
|
||
$b = (float) substr($value, $pos+1);
|
||
return ($b == 0) ? ($a) : ($a / $b);
|
||
}
|
||
|
||
|
||
function exif_get_shutter($apex) {
|
||
$apex = exif_get_float($apex);
|
||
$shutter = pow(2, -$apex);
|
||
if ($shutter == 0) return false;
|
||
if ($shutter >= 1) return round($shutter) . 's';
|
||
return '1/' . round(1 / $shutter) . 's';
|
||
}
|
||
|
||
function exif_get_fstop(&$exif) {
|
||
if (!isset($exif['ApertureValue'])) return false;
|
||
$apex = exif_get_float($exif['ApertureValue']);
|
||
$fstop = pow(2, $apex/2);
|
||
if ($fstop == 0) return false;
|
||
return 'f/' . round($fstop,1);
|
||
}
|
||
*/
|
||
|
||
// === DISPLAY EXIF === //
|
||
|
||
/* return geo exif in a nice form
|
||
|
||
*/
|
||
|
||
function geo_frac2dec($str) {
|
||
@list( $n, $d ) = explode( '/', $str );
|
||
if ( !empty($d) )
|
||
return $n / $d;
|
||
return $str;
|
||
}
|
||
|
||
|
||
/*
|
||
33° 52.37′ 0″ S 151° 9.06′ 0″ E
|
||
*/
|
||
|
||
|
||
function geo_pretty_fracs2dec($fracs) {
|
||
return geo_frac2dec($fracs[0]) . '° ' .
|
||
geo_frac2dec($fracs[1]) . '′ ' .
|
||
geo_frac2dec($fracs[2]) . '″ ';
|
||
}
|
||
|
||
|
||
/*
|
||
to GoogleMaps
|
||
*/
|
||
|
||
function geo_single_fracs2dec($fracs) {
|
||
return geo_frac2dec($fracs[0]) +
|
||
geo_frac2dec($fracs[1]) / 60 +
|
||
geo_frac2dec($fracs[2]) / 3600;
|
||
}
|
||
|
||
/* Crée le cadre Afficher les exifs (WorPress)
|
||
single.php:67:
|
||
single.php:123:
|
||
functions.php:555:
|
||
functions.php:794:
|
||
loop-attachment.php:138:
|
||
loop-single.php:117:
|
||
loop-single.php:151:
|
||
loop-single.php:197:
|
||
*/
|
||
|
||
function ListeExif($meta, $attach, $i){
|
||
$before_item = '<li>';
|
||
$after_item = '</li>';
|
||
$sep = ': ';
|
||
$zoom = '11';
|
||
$exif_list = '';
|
||
$gm_lat = '';
|
||
$gm_lng = '';
|
||
|
||
if (!empty($meta['image_meta']['latitude']))
|
||
$latitude = $meta['image_meta']['latitude'];
|
||
if (!empty($meta['image_meta']['longitude']))
|
||
$longitude = $meta['image_meta']['longitude'];
|
||
if (!empty($meta['image_meta']['latitude_ref']))
|
||
$lat_ref = $meta['image_meta']['latitude_ref'];
|
||
if (!empty($meta['image_meta']['longitude_ref']))
|
||
$lng_ref = $meta['image_meta']['longitude_ref'];
|
||
|
||
// Aperture
|
||
if (!empty($meta['image_meta']['aperture']))
|
||
$exif_list .= $before_item . __('Aperture', 'twentyten-child') . $sep . "f/" . $meta['image_meta']['aperture'] . $after_item;
|
||
|
||
// Shutter speed
|
||
if (!empty($meta['image_meta']['shutter_speed'])) {
|
||
$exif_list .= $before_item . __('Shutter speed', 'twentyten-child') . $sep;
|
||
if ((1 / $meta['image_meta']['shutter_speed']) > 1) {
|
||
$exif_list .= "1/";
|
||
if ((number_format((1 / $meta['image_meta']['shutter_speed']), 1)) == 1.3
|
||
or number_format((1 / $meta['image_meta']['shutter_speed']), 1) == 1.5
|
||
or number_format((1 / $meta['image_meta']['shutter_speed']), 1) == 1.6
|
||
or number_format((1 / $meta['image_meta']['shutter_speed']), 1) == 2.5) {
|
||
$exif_list .= number_format((1 / $meta['image_meta']['shutter_speed']), 1, '.', '') . " s" . $after_item;
|
||
}
|
||
else {
|
||
$exif_list .= number_format((1 / $meta['image_meta']['shutter_speed']), 0, '.', '') . " s" . $after_item;
|
||
}
|
||
}
|
||
else {
|
||
$exif_list .= $meta['image_meta']['shutter_speed']." s" . $after_item;
|
||
}
|
||
}
|
||
// Focal length
|
||
if (!empty($meta['image_meta']['focal_length']))
|
||
$exif_list .= $before_item . __('Focal length', 'twentyten-child') . $sep . $meta['image_meta']['focal_length'] . " mm" . $after_item;
|
||
// Camera
|
||
if (!empty($meta['image_meta']['camera']))
|
||
$exif_list .= $before_item . __('Camera', 'twentyten-child') . $sep . $meta['image_meta']['camera'] . $after_item;
|
||
// Creation time
|
||
if (!empty($meta['image_meta']['created_timestamp']))
|
||
/*
|
||
setlocale(LC_TIME, 'fr_FR');
|
||
echo $meta['image_meta']['created_timestamp'];
|
||
$dt = strftime("%e %B %Y", $meta['image_meta']['created_timestamp']);
|
||
$dt = mb_convert_encoding($dt, 'utf-8');
|
||
echo $dt;
|
||
*/
|
||
$exif_list .= $before_item . __('Taken', 'twentyten-child') . $sep . date(__('j F, Y', 'twentyten-child'),$meta['image_meta']['created_timestamp']) . $after_item;
|
||
|
||
// Latitude and Longtitude
|
||
//if ($latitude != 0 && $longitude != 0) {
|
||
if (isset($latitude) && isset($longitude)) {
|
||
|
||
$lat = geo_single_fracs2dec($latitude);
|
||
$lng = geo_single_fracs2dec($longitude);
|
||
|
||
if ($lat_ref == 'S') { $neg_lat = '-'; } else { $neg_lat = ''; }
|
||
if ($lng_ref == 'W') { $neg_lng = '-'; } else { $neg_lng = ''; }
|
||
|
||
$gm_lat = $neg_lat . number_format($lat,6);
|
||
$gm_lng = $neg_lng . number_format($lng, 6);
|
||
|
||
$geo_link = '<a href="http://maps.google.com/maps?q=' . $neg_lat . number_format($lat,6) . '+' . $neg_lng . number_format($lng, 6) . '&z=11">';
|
||
$geo_link .= '<img src="' . get_stylesheet_directory_uri() . '/images/monde.png" width="16" height="16" />';
|
||
$geo_link .= '</a>';
|
||
|
||
$exif_list .= $before_item . $geo_link . $after_item;
|
||
//affichage dans un cadre map caché
|
||
//$exif_list .= $before_item . '<a href="#carte" title="'. __('Display/hide on map', 'twentyten-child') . '" onclick="toggleExif(\'map_canvas' . $i . '\');"><img src="' . get_stylesheet_directory_uri() . '/images/monde.png" width="16" height="16" /></a>' . $after_item;
|
||
}
|
||
|
||
// Titre du marker
|
||
if (!empty($meta['image_meta']['title'])) $title_marker = $meta['image_meta']['title'];
|
||
elseif (!empty($meta['file'])) {
|
||
// en 2 lignes, sinon erreur Strict Standards: Only variables should be passed by reference
|
||
$tmp = explode("/", $meta['file']);
|
||
$title_marker = end($tmp);
|
||
}
|
||
|
||
//if ((isset($exif_list)) & (isset($gm_lat)) & (isset($gm_lng)) & (isset($title_marker))) {
|
||
return array($exif_list, $gm_lat, $gm_lng, $title_marker);
|
||
//}
|
||
}
|
||
|
||
|
||
/* NON UTILISE */
|
||
|
||
function _ListeExif($meta, $attachment){
|
||
$before_item = '<li>';
|
||
$after_item = '</li>';
|
||
$sep = ': ';
|
||
$zoom = '11';
|
||
//print_r($meta);
|
||
if ($meta['image_meta']['latitude'])
|
||
$latitude = $meta['image_meta']['latitude'];
|
||
if ($meta['image_meta']['longitude'])
|
||
$longitude = $meta['image_meta']['longitude'];
|
||
if ($meta['image_meta']['latitude_ref'])
|
||
$lat_ref = $meta['image_meta']['latitude_ref'];
|
||
if ($meta['image_meta']['longitude_ref'])
|
||
$lng_ref = $meta['image_meta']['longitude_ref'];
|
||
|
||
$lat = geo_single_fracs2dec($latitude);
|
||
$lng = geo_single_fracs2dec($longitude);
|
||
if ($lat_ref == 'S') { $neg_lat = '-'; } else { $neg_lat = ''; }
|
||
if ($lng_ref == 'W') { $neg_lng = '-'; } else { $neg_lng = ''; }
|
||
|
||
$gm_lat = $neg_lat . number_format($lat,6);
|
||
$gm_lng = $neg_lng . number_format($lng, 6);
|
||
$start_geo_link = '<a href="http://maps.google.com/maps?q=' . $gm_lat . '+' . $gm_lng . '&z='. $zoom . '">';
|
||
$end_geo_link = '</a>';
|
||
|
||
// Aperture
|
||
if (!empty($meta['image_meta']['aperture']))
|
||
$exif_list .= $before_item . __('Aperture', 'twentyten-child') . $sep . "f/" . $meta['image_meta']['aperture'] . $after_item;
|
||
|
||
// Shutter speed
|
||
if (!empty($meta['image_meta']['shutter_speed'])) {
|
||
$exif_list .= $before_item . __('Shutter speed', 'twentyten-child') . $sep;
|
||
if ((1 / $meta['image_meta']['shutter_speed']) > 1) {
|
||
$exif_list .= "1/";
|
||
if ((number_format((1 / $meta['image_meta']['shutter_speed']), 1)) == 1.3
|
||
or number_format((1 / $meta['image_meta']['shutter_speed']), 1) == 1.5
|
||
or number_format((1 / $meta['image_meta']['shutter_speed']), 1) == 1.6
|
||
or number_format((1 / $meta['image_meta']['shutter_speed']), 1) == 2.5) {
|
||
$exif_list .= number_format((1 / $meta['image_meta']['shutter_speed']), 1, '.', '') . " s" . $after_item;
|
||
}
|
||
else {
|
||
$exif_list .= number_format((1 / $meta['image_meta']['shutter_speed']), 0, '.', '') . " s" . $after_item;
|
||
}
|
||
}
|
||
else {
|
||
$exif_list .= $meta['image_meta']['shutter_speed']." s" . $after_item;
|
||
}
|
||
}
|
||
// Focal length
|
||
if (!empty($meta['image_meta']['focal_length']))
|
||
$exif_list .= $before_item . __('Focal length', 'twentyten-child') . $sep . $meta['image_meta']['focal_length'] . " mm" . $after_item;
|
||
// Camera
|
||
if (!empty($meta['image_meta']['camera']))
|
||
$exif_list .= $before_item . __('Camera', 'twentyten-child') . $sep . $meta['image_meta']['camera'] . $after_item;
|
||
// Creation time
|
||
if (!empty($meta['image_meta']['created_timestamp']))
|
||
$exif_list .= $before_item . __('Taken', 'twentyten-child') . $sep . date('j F, Y',$meta['image_meta']['created_timestamp']) . $after_item;
|
||
// F j, Y, g:i a
|
||
|
||
//echo $exif_list;
|
||
|
||
// Latitude and Longtitude
|
||
if ($latitude != 0 && $longitude != 0)
|
||
//affichage dans un cadre map caché
|
||
//$exif_list .= $before_item . '<div onclick="toggleExif(\'map\');" ><image src="' . get_stylesheet_directory_uri() . '/images/monde.png" width="16" height="16" /></div>' . $after_item;
|
||
$exif_list .= $before_item . '<image onclick="toggleExif(\'map\');" src="' . get_stylesheet_directory_uri() . '/images/monde.png" width="16" height="16" />' . $after_item;
|
||
//$exif_list .= $before_item . '<img onclick="toggleExif(map'. $attachment . ');" src="' . get_stylesheet_directory_uri() . '/images/monde.png" width="16" height="16" />' . $after_item;
|
||
|
||
// Titre du marker
|
||
if ($meta['image_meta']['caption']) $title_marker = $meta['image_meta']['caption'];
|
||
elseif ($meta['file']) $title_marker = $meta['file'];
|
||
|
||
|
||
|
||
//echo "exif_list: " . $exif_list;
|
||
return array($exif_list, $gm_lat, $gm_lng, $title_marker);
|
||
}
|
||
|
||
|
||
/* NON UTILISE */
|
||
|
||
function mod_image($id){
|
||
|
||
$ajout .= '</a></p>' . "\n" . '<div class="droite" onclick="toggleExif(' . $id . ');">Voir les Exif</div>';
|
||
$ajout .= '<div class="bloc_exif" id="' . $id .'">' . "\n";
|
||
$ajout .= '<ul class="exif" id="bloc_exif">';
|
||
list($liste_exif, $gm_lat, $gm_lng, $title_marker) = att_exif($id);
|
||
//$ajout .= att_exif($id);
|
||
$ajout .= $liste_exif;
|
||
$ajout .= '</ul></div>';
|
||
|
||
$ajout .= '<div class="mappy" id="map' . $id . '"></div>';
|
||
|
||
//<!--div id="map"></div-->
|
||
|
||
$ajout .= '<script type="text/javascript">';
|
||
$ajout .= 'var contentString = "' . $title_marker . '";';
|
||
$ajout .= 'var latlng = new google.maps.LatLng(' .$gm_lat .', ' . $gm_lng . ');';
|
||
$ajout .= 'initialize();';
|
||
$ajout .= 'marker = createMarker(latlng, \'\', contentString, map);';
|
||
$ajout .= '</script>';
|
||
?>
|
||
<!--script type="text/javascript">
|
||
var contentString = "<?php echo $title_marker; ?>";
|
||
var latlng = new google.maps.LatLng(<?php echo $gm_lat; ?>, <?php echo $gm_lng; ?>);
|
||
initialize();
|
||
marker = createMarker(latlng, '', contentString, map);
|
||
</script-->
|
||
|
||
<?php
|
||
return $ajout;
|
||
}
|
||
|
||
|
||
/*
|
||
functions.php:737:
|
||
functions.php:738:
|
||
functions.php:765:
|
||
*/
|
||
|
||
function att_exif($a){
|
||
global $attachment;
|
||
$att = ($attachment[$a][1]);
|
||
$att = substr_replace($att, '', 0, 18);
|
||
|
||
$metadata = wp_get_attachment_metadata($att);
|
||
//print_r($metadata);
|
||
/*
|
||
$before_block = '<div class="bloc_exif" id="' . $att . '"><ul>';
|
||
$after_block = '</ul></div>';
|
||
|
||
$liste_exif = $before_block;
|
||
*/
|
||
// ListeExif renvoie 3 paramètres dans un tableau:
|
||
// -les exifs sous forme de liste
|
||
// -latitude et longitude pour le javascript
|
||
// -le caption ou le nom du fichier pour l'infoWindow
|
||
list($exif_list, $gm_lat, $gm_lng, $title_marker) = ListeExif($metadata,$a);
|
||
|
||
//echo $exif_list;
|
||
|
||
$liste_exif .= $exif_list;
|
||
$liste_exif .= $after_block;
|
||
//echo $liste_exif;
|
||
|
||
//return $liste_exif;
|
||
return array($liste_exif, $gm_lat, $gm_lng, $title_marker);
|
||
}
|
||
|
||
|
||
/* Requete pour récupérer les exifs d'une image dans Zenphoto
|
||
loop-single.php:147
|
||
*/
|
||
|
||
function zp_query($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`, `EXIFGPSLatitude`, `EXIFGPSLatitudeRef`, `EXIFGPSLongitude`, `EXIFGPSLongitudeRef`, `EXIFGPSAltitude`, `EXIFGPSAltitudeRef`, `desc`, `title` 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 7D
|
||
[1] => 2011:06:30 20:43:30
|
||
[2] => 1/400 sec
|
||
[3] => f/6,3
|
||
[4] => 640
|
||
[5] => 600 mm
|
||
[6] => lat
|
||
[7] => lat ref
|
||
[8] => long
|
||
[9] => long ref
|
||
[10] => alt
|
||
[11] => alt ref
|
||
[12] => desc
|
||
[13] => title
|
||
)*/
|
||
$meta = array();
|
||
$meta['image_meta']['camera'] = $exif[0];
|
||
$meta['image_meta']['created_timestamp'] = $exif[1];
|
||
$meta['image_meta']['shutter_speed'] = $exif[2];
|
||
$meta['image_meta']['aperture'] = $exif[3];
|
||
$meta['image_meta']['iso'] = $exif[4];
|
||
$meta['image_meta']['focal_length'] = $exif[5];
|
||
$meta['image_meta']['latitude'] = $exif[6];
|
||
$meta['image_meta']['latitude_ref'] = $exif[7];
|
||
$meta['image_meta']['longitude'] = $exif[8];
|
||
$meta['image_meta']['longitude_ref'] = $exif[9];
|
||
$meta['image_meta']['altitude'] = $exif[10];
|
||
$meta['image_meta']['altitude_ref'] = $exif[11];
|
||
|
||
if ($exif[12] != "") {
|
||
$desc = explode(':', $exif[12]);
|
||
$description = explode('"', end($desc));
|
||
//print_r($description);
|
||
$meta['image_meta']['description'] = utf8_encode($description[1]);
|
||
}
|
||
else $meta['image_meta']['description'] = "";
|
||
|
||
if ($exif[13] != "") {
|
||
//echo "exif: " . $exif[13] . "<br>";
|
||
// a:1:{s:5:"fr_FR";s:30:"2011-05-15_GP-France-2011_9798";}
|
||
|
||
$titr = explode(':', $exif[13]);
|
||
//echo count($titr) . "<br>";
|
||
|
||
if (count($titr) == 1) {
|
||
//print_r($titr);
|
||
//$titr[0]
|
||
$meta['image_meta']['title'] = utf8_encode($titr[0]);
|
||
}
|
||
else {
|
||
$titre = explode('"', end($titr));
|
||
//print_r($titre);
|
||
//$titre[1]
|
||
$meta['image_meta']['title'] = utf8_encode($titre[1]);
|
||
}
|
||
/*
|
||
echo "titr: ";
|
||
print_r($titr);
|
||
echo "<br>";
|
||
|
||
$titre = explode('"', end($titr));
|
||
print_r($titre);
|
||
|
||
foreach ($titr as $var) {
|
||
echo "<i>" . $var . "</i><br>";
|
||
}
|
||
|
||
*/
|
||
//$meta['image_meta']['title'] = utf8_encode($titre[1]);
|
||
}
|
||
else $meta['image_meta']['title'] = "";
|
||
|
||
//echo "<br><br>";
|
||
$meta['image_meta']['file'] = $image;
|
||
|
||
//preprint($meta['image_meta']);
|
||
|
||
/*
|
||
[camera] => Canon EOS-1D Mark IV
|
||
[created_timestamp] => 2014:10:21 14:42:26
|
||
[shutter_speed] => 1/80 sec
|
||
[aperture] => f/9
|
||
[iso] => 320
|
||
[focal_length] => 17 mm
|
||
[latitude] => 44,381861666667
|
||
[latitude_ref] => N
|
||
[longitude] => 4,4162216666667
|
||
[longitude_ref] => E
|
||
[altitude] => 104,1771m
|
||
[altitude_ref] =>
|
||
[description] =>
|
||
[title] =>
|
||
*/
|
||
return $meta;
|
||
}
|
||
|
||
function Getfloat($str) {
|
||
if(strstr($str, ",")) {
|
||
$str = str_replace(".", "", $str); // replace dots (thousand seps) with blancs
|
||
$str = str_replace(",", ".", $str); // replace ',' with '.'
|
||
}
|
||
|
||
if(preg_match("#([0-9\.]+)#", $str, $match)) { // search for number that may contain '.'
|
||
return floatval($match[0]);
|
||
} else {
|
||
return floatval($str); // take some last chances with floatval
|
||
}
|
||
}
|
||
|
||
/* Crée le cadre Afficher les exifs (Zenphoto)
|
||
loop-single.php:151
|
||
*/
|
||
|
||
function ListeExifZP($meta){
|
||
$before_item = '<li>';
|
||
$after_item = '</li>';
|
||
$sep = ': ';
|
||
$zoom = '11';
|
||
$exif_list = "";
|
||
$latitude = "";
|
||
$longitude = "";
|
||
$gm_lat = "";
|
||
$gm_lng = "";
|
||
|
||
if (!empty($meta['image_meta']['latitude']))
|
||
$latitude = $meta['image_meta']['latitude'];
|
||
if (!empty($meta['image_meta']['longitude']))
|
||
$longitude = $meta['image_meta']['longitude'];
|
||
if (!empty($meta['image_meta']['latitude_ref']))
|
||
$lat_ref = $meta['image_meta']['latitude_ref'];
|
||
if (!empty($meta['image_meta']['longitude_ref']))
|
||
$lng_ref = $meta['image_meta']['longitude_ref'];
|
||
|
||
// Aperture
|
||
if (!empty($meta['image_meta']['aperture']))
|
||
$exif_list .= $before_item . __('Aperture', 'twentyten-child') . $sep . str_replace(',', '.', $meta['image_meta']['aperture']) . $after_item;
|
||
|
||
// Shutter speed
|
||
if (!empty($meta['image_meta']['shutter_speed']))
|
||
$exif_list .= $before_item . __('Shutter speed', 'twentyten-child') . $sep . str_replace('sec', 's', $meta['image_meta']['shutter_speed']) . $after_item;
|
||
|
||
// Focal length
|
||
if (!empty($meta['image_meta']['focal_length']))
|
||
$exif_list .= $before_item . __('Focal length', 'twentyten-child') . $sep . $meta['image_meta']['focal_length'] . $after_item;
|
||
// Camera
|
||
if (!empty($meta['image_meta']['camera']))
|
||
$exif_list .= $before_item . __('Camera', 'twentyten-child') . $sep . $meta['image_meta']['camera'] . $after_item;
|
||
// Creation time
|
||
if (!empty($meta['image_meta']['created_timestamp']))
|
||
/*
|
||
setlocale(LC_TIME, 'fr_FR');
|
||
echo $meta['image_meta']['created_timestamp'];
|
||
$dt = strftime("%e %B %Y", $meta['image_meta']['created_timestamp']);
|
||
$dt = mb_convert_encoding($dt, 'utf-8');
|
||
echo $dt;
|
||
*/
|
||
|
||
$pieces = explode(' ', $meta['image_meta']['created_timestamp']);
|
||
list($yy, $mm, $dd) = explode(':', $pieces[0]);
|
||
list($hh, $min, $ss) = explode(':', $pieces[1]);
|
||
$timestamp = mktime((int) $hh, (int) $min, (int) $ss, (int) $mm, (int) $dd, (int) $yy);
|
||
$ddate = date('d.m.Y à H:i',$timestamp);
|
||
|
||
$exif_list .= $before_item . __('Taken', 'twentyten-child') . $sep . $ddate . $after_item;
|
||
|
||
// Latitude and Longtitude
|
||
if (($latitude != "") && ($longitude != "")) {
|
||
|
||
if ($lat_ref == 'S') { $neg_lat = '-'; } else { $neg_lat = ''; }
|
||
if ($lng_ref == 'W') { $neg_lng = '-'; } else { $neg_lng = ''; }
|
||
|
||
$gm_lat = $neg_lat . number_format(Getfloat($latitude), 6);
|
||
$gm_lng = $neg_lng . number_format(Getfloat($longitude), 6);
|
||
|
||
$geo_link = '<a href="http://maps.google.com/maps?q=' . $gm_lat . '+' . $gm_lng . '&z=11" title="' . __('See on Google Maps', 'twentyten-child') . '">';
|
||
$geo_link .= '<img src="' . get_stylesheet_directory_uri() . '/images/monde.png" width="16" height="16" />';
|
||
$geo_link .= '</a>';
|
||
|
||
//affichage dans un cadre map caché
|
||
//$exif_list .= $before_item . '<a href="#carte" title="'. __('Display/hide on map', 'twentyten-child') . '" onclick="toggleExif(\'map_canvas' . $i . '\');"><img src="' . get_stylesheet_directory_uri() . '/images/monde.png" width="16" height="16" /></a>' . $after_item;
|
||
$exif_list .= $before_item . $geo_link . $after_item;
|
||
}
|
||
// Titre du marker
|
||
if (!empty($meta['image_meta']['description'])) $title_marker = $meta['image_meta']['description'];
|
||
elseif (!empty($meta['image_meta']['title'])) $title_marker = $meta['image_meta']['title'];
|
||
//elseif (!empty($meta['image_meta']['file'])) $title_marker = $meta['image_meta']['file'];
|
||
|
||
return array($exif_list, $gm_lat, $gm_lng, $title_marker);
|
||
}
|
||
|
||
|
||
|
||
/*
|
||
add_filter('the_content', 'exif_content', 20);
|
||
|
||
function exif_content($content) {
|
||
if ( is_single() )
|
||
$content = $content . "exif";
|
||
return $content;
|
||
}
|
||
|
||
|
||
function replace_http( $original ) {
|
||
// use preg_replace() to replace http:// with https://
|
||
//$output = preg_replace( "^http:", "https:", $original );
|
||
|
||
$output = preg_replace( "/^http:/i", "https:", $original );
|
||
|
||
return $output;
|
||
}
|
||
|
||
add_filter( 'the_content', 'replace_http' );
|
||
*/
|
||
?>
|