$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 = '';
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. "' . $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] . "(.*?)<\/p>/'; //$pattern = '/
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]"; //
echo $matches2[0][2];
*/
//echo "count(matches2): " . count($matches2) . "
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 = "
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
?>
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}" ); } */ ?>