From be5f9815e8a109535b6a4f289d8d1cfa2eed9144 Mon Sep 17 00:00:00 2001 From: Bruno 21 Date: Sat, 17 Aug 2019 16:54:13 +0200 Subject: [PATCH] Reinstall silverbook --- footer.php | 22 +- functions.php | 678 +++++++++++++++++++++++++++++++++++++++++------- header.php | 34 ++- js/child.js | 11 +- loop-single.php | 390 ++++++++++++++++++++++------ style.css | 125 ++++++++- 6 files changed, 1077 insertions(+), 183 deletions(-) diff --git a/footer.php b/footer.php index 0adba33..9764af5 100644 --- a/footer.php +++ b/footer.php @@ -21,7 +21,7 @@ */ get_sidebar( 'footer' ); ?> - +
+ + + - - + + + + diff --git a/functions.php b/functions.php index 452e9b6..31b2fa8 100644 --- a/functions.php +++ b/functions.php @@ -1,5 +1,6 @@ $serial ) ); update_option( 'wr2x_pro_status', _( "Your subscription is manually enabled." ) ); @@ -13,74 +14,164 @@ add_filter('sanitize_file_name', 'remove_accents' ); 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 +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.3.1'); + wp_enqueue_script('jquery'); + } } +add_action('init', 'google_jquery'); -// la fonction myThemeAdminMenu( ) sera exécutée -// quand WordPress mettra en place le menu d'admin +function enqueue_my_scripts() { + //wp_enqueue_script('google-maps', '//maps.googleapis.com/maps/api/js?key=AIzaSyB7cAx3NSH4dPM3Sx2oQeud7Zr-KaGXmLk&callback=initMap', array(), '3', true); + //wp_enqueue_script('google-maps', '//maps.googleapis.com/maps/api/js?key=AIzaSyB7cAx3NSH4dPM3Sx2oQeud7Zr-KaGXmLk&callback=MapApiLoaded', array(), '3', true); + //wp_enqueue_script('google-jsapi','https://www.google.com/jsapi'); -add_action( 'admin_menu', 'myThemeAdminMenu' ); + wp_enqueue_script( 'child', get_stylesheet_directory_uri() . '/js/child.js', '', '',false ); + } +add_action( 'wp_enqueue_scripts', 'enqueue_my_scripts' ); -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 +// Settings + +//http://cssmary.com/wordpress/customizer-api-child-theme/ +function childtheme_customize_register( $wp_customize ) { + + // 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','twentyten-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 (end with /)','twentyten-child'), + 'section' => 'settings_section', + 'type' => 'text', + ))); + $wp_customize->add_setting('dess_zp_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_zp_size', array( + 'settings' => 'dess_zp_size', + 'label' => __('Zenphoto image size (px)','twentyten-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)','twentyten-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")','twentyten-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','twentyten-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','twentyten-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','twentyten-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)','twentyten-child'), + 'section' => 'settings_section', + 'type' => 'checkbox', + ) ); + + } +add_action( 'customize_register', 'childtheme_customize_register', 12); + +function theme_setting($name, $default = false) { + return get_theme_mod( $name, $default ); } - -// La page des settings - -function myThemeSettingsPage( ) { -?> -
-

Options de mon thème

- -
- - - - - - - - - - - - - - - - - -
/>
-

- -

-
-
-"; + */ + /* + Array ( + [album] => sports-mecaniques/24H-Mans-2016 + [image] => 2016-04-10_24H-Mans_9717.jpg + [folder] => false + ) + */ - $host = (($_SERVER['HTTPS'] != "") ? "https" : "http") . '://' . $_SERVER['HTTP_HOST'] . '/zenphoto/'; + $selector = theme_setting('dess_lightbox_select'); + $zenphoto_url = theme_setting('dess_zenphoto'); + $size = theme_setting('dess_zp_size'); - $zenphoto_url2 = get_option( 'zenphoto_url' ); -//echo $zenphoto_url2 . "
"; -//preprint($zenphoto_url2); -//echo substr_count($zenphoto_url2, "https"); -//echo $_SERVER['HTTPS']; + $album = ! empty( $atts['album'] ) ? $atts['album'] : ''; + $album = filter_var($album, FILTER_SANITIZE_STRING); - 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; + $image = ! empty( $atts['image'] ) ? $atts['image'] : ''; + $image = filter_var($image, FILTER_SANITIZE_STRING); - $size = get_option( 'img_size' ); - $folder = false; + $caption = ! empty( $atts['caption'] ) ? $atts['caption'] : ''; + $caption = filter_var($caption, FILTER_SANITIZE_STRING); + + $folder = ! empty( $atts['folder'] ) ? $atts['folder'] : ''; + $folder = filter_var($folder, FILTER_VALIDATE_BOOLEAN); + + $rnd = rand (1000, 9999); + + $filename = ""; $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); + //echo dirname(__FILE__); + //echo __FILE__; - $filename = $zenphoto_url . 'cache/' . $atts['album'] . '/' . urlencode($img) . '_' . $size . '_watermark.jpg'; - $zp_size = getimagesize(htmlentities($filename)); + // require ($_SERVER["DOCUMENT_ROOT"]."/path/to/file.php"); - //if ($folder == false) $zenphoto_link = ''; - if ($folder == false) $zenphoto_link = ''; - else $zenphoto_link = ''; + //require(dirname(__FILE__) . '/Connections/cnx.php'); + 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` = '" . $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.", 'twentyten-child' ); + } + $result->close(); + } + + $img_query = "SELECT `desc`, `title`, `filename` FROM `" . $zp_prefix . "images` WHERE `albumid` = '" . $album_id . "'"; + if ($result = $mysqli->query($img_query)) { + if ($mysqli->affected_rows != 0) { + $capt = $result->fetch_row(); + } + else { + _e("Unknow image.", 'twentyten-child' ); + } + $result->close(); + } + + +//echo "image1: " . $image . "
"; + + + // (3) Si juste un album est donné, on cherche l'image la plus récente de l'album + + if (($album != "") && ($image == "")) { + + // 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.", 'twentyten-child' ); + } + $result->close(); + } + + echo "img_album: " . $img_album . "
"; + + $image = $img_album; + $folder = true; + } // album != "" + +//echo "image2: " . $image . "
"; + + if ($capt[0] != "") $title = $capt[0]; + elseif ($capt[1] != "") $title = $capt[1]; + elseif ($capt[2] != "") $title = $capt[2]; + + $img = substr($image, 0, strlen($image) - 4); + +//echo "img: " . $img . "
"; + + $filename = $zenphoto_url . 'cache/' . $atts['album'] . '/' . urlencode($img) . '_' . $size . '_watermark.jpg'; + +//echo "filename: " . $filename . "

"; + + $zp_size = getimagesize(htmlentities($filename)); + + if ($folder === false) { + $zenphoto_link = '
'; + } + else { + $zenphoto_link = ''; + } + $zenphoto_img .= $zenphoto_link; $zenphoto_img .= ' @@ -185,6 +373,7 @@ function zenphoto_handler($atts, $content=null) { add_shortcode( 'zenphoto', 'zenphoto_handler' ); +// include /* NON UTILISE */ @@ -835,6 +1024,7 @@ function zp_query($zpimage) { $exif = array(); require('../Connections/cnx.php'); + $mysqli = new mysqli($dbhost, $dbuser, $dbpassword, $dbtable); if (mysqli_connect_errno()) { @@ -1046,6 +1236,318 @@ function ListeExifZP($meta){ + + +/* +* fmulticurl(): recherche et récupère des infos sur Wikipedia +* +* entree $query (array) (tableau contenant les données à rechercher sur wikipedia (1 entrée/image)) +* retourne $obj (array) +* +* single.php - tpl-carte.php +*/ + +function fmulticurl($query) { + + $url = "https://fr.wikipedia.org/w/api.php"; + $erreur = array(); + + /* contruction de la requete opensearch */ + + $fields = array( + 'action' => 'opensearch', + //'search' => $query, + 'format' => 'json', + 'profile' => 'strict' //strict, normal, *fuzzy*, classic + ); + + $fields_string = ""; + foreach($fields as $key=>$value) { + $fields_string .= $key.'='.$value.'&'; + } + + /* nettoyage expressions à rechercher */ + /* + echo "requete avant clean_req_wiki
"; + var_dump($query); + */ + $wiki = clean_req_wiki($query); + //$wiki = $query; + + /* + echo "requete apres clean_req_wiki
"; + var_dump($wiki); + */ + /* constructions des requetes */ + + foreach ($wiki as &$val) { + //$val = $url . "?" . $fields_string . "search=" . str_replace(" ", "_", trim($val)); + $val = $url . "?" . $fields_string . "search=" . $val; + } + + //create the multiple cURL handle + $mh = curl_multi_init(); + + $nbr = count($query); + + // set URL and options + for($x = 0; $x < $nbr; $x++){ + + $ch[$x] = curl_init(); + + curl_setopt($ch[$x], CURLOPT_URL, $wiki[$x]); + //curl_setopt($ch[$x], CURLOPT_POST, 1);// set post data to true + //curl_setopt($ch[$x], CURLOPT_POSTFIELDS, $fields); // post data + + curl_setopt($ch[$x], CURLOPT_HEADER, 0); + curl_setopt($ch[$x], CURLOPT_USERAGENT, 'ClicBot/1.0 (https://clicclac.info/; contact@clicclac.info)'); + curl_setopt($ch[$x], CURLOPT_RETURNTRANSFER, true ); + curl_setopt($ch[$x], CURLOPT_SSL_VERIFYPEER, false); + + curl_multi_add_handle($mh,$ch[$x]); + } + + + $running = null; + + do { + curl_multi_exec($mh, $running); + } while ($running); + + for($x = 0; $x < $nbr; $x++){ + $result = curl_multi_getcontent($ch[$x]); + $obj[]= json_decode($result, true); + + //get info about the request + // $error = curl_getinfo($ch[$x], CURLINFO_HTTP_CODE); + // if($error != 200){ + + if (curl_errno($ch[$x])) { + $erreur[] = array("Url" =>curl_getinfo($ch[$x], CURLINFO_EFFECTIVE_URL), "error_info" => curl_getinfo($ch[$x])); + } + + //error handling + /* + 200 : succès de la requête ; + 301 et 302 : redirection, respectivement permanente et temporaire ; + 401 : utilisateur non authentifié ; + 403 : accès refusé ; + 404 : page non trouvée ; + 500 et 503 : erreur serveur. + */ + + curl_multi_remove_handle($mh, $ch[$x]); + curl_close($ch[$x]); + } + + curl_multi_close($mh); + +/* OK Remplace les entrées vides par "" + for ($a = 0; $a < count($obj); $a++){ + + if (is_array($obj[$a])) { + + for ($b = 0; $b < count($obj[$a]); $b++){ + + if (empty($obj[$a][$b])) { + $obj[$a][$b][0] = ""; + } + } + + } //if + + } //for +*/ + //echo "retour de la requete
"; + //var_dump($obj); + + for ($a = 0; $a < count($obj); $a++){ + /* + $req = str_replace("_", " ", $obj[$a][0]); + $req = " " . $req . " "; + */ + $req = $query[$a]; + $req = " " . $req . " "; + + /* + if (is_array($obj[$a])) { + + for ($b = 0; $b < count($obj[$a]); $b++){ + + if (empty($obj[$a][$b])) { + $obj[$a][$b][0] = ""; + } + + } //for + + } //if + */ + + foreach ($obj[$a][2] as $key => $val) { + //if (stripos(substr($val, 0, 50), $req) !== false) echo "matche $key"; + //echo "nettoyage du retour de la requete
"; + $l = substr($val, 0, 50); + + + //var_dump($req, $val, $l); + + if (stripos(substr($val, 0, 50), $req) === false) { + //echo "on supprime
"; + unset($obj[$a][1][$key]); + unset($obj[$a][3][$key]); + unset($obj[$a][2][$key]); + } + + } + + } //for + + + if (count($erreur) > 0) var_dump($erreur); + + //echo "retour de la function multicurl
"; + //var_dump($obj); + + return $obj; +} + + + +/* +* safe_array_access(): recherche et récupère des infos sur Wikipedia +* +* entree $query (array) (tableau contenant les données à rechercher sur wikipedia (1 entrée/image)) +* retourne $obj (array) +* +* single.php - tpl-carte.php +*/ + +function safe_array_access($ar){ + $numargs = func_num_args(); + $arg_list = func_get_args(); + $aritterator = $ar; + for($i = 1; $i < $numargs; $i++){ + if (isset($aritterator[$arg_list[$i]]) || array_key_exists($arg_list[$i], $aritterator)){ + $aritterator = $aritterator[$arg_list[$i]]; + }else{ + return(false); + } + } + return($aritterator); +} + + +/* +* clean_req_wiki(): nettoie la requete pour Wikipedia +* +* entree $req (array) (tableau contenant les données à rechercher sur wikipedia (1 entrée/image)) +* retourne $q (array) (supprime les tags, les articles en début d'expression, les accents, trim , remplace les " " par "_" +* +* functions.php - fmulticurl() +*/ + +function clean_req_wiki ($req) { + $q = array(); + $pat = "#_([^)]*)_#"; + + foreach($req as $val) { + + $z = strip_tags($val); + /* + $fichier = preg_match($pat, $z, $match1); + if ($fichier === 1) $h = $match1[1]; + else $h = $z; + */ + + //$y= supp_article($z); + $y= supprime_article($z); + + $x = str_to_noaccent($y); + + //$v = strtolower($w); + + $v = str_replace(" ", "_", $x); + + $q[] = trim($v); + + } + + return $q; +} + + +function clean_photo_name($str) { + $pat = "#_([^)]*)_#"; + + $fichier = preg_match($pat, $str, $match1); + if ($fichier === 1) $h = $match1[1]; + else $h = $z; + + return $h; + } + +function supp_entre_parenth($str) { + $pattern3 = "#\\([^)]*\\)#"; + + $m = preg_replace($pattern3, "", $str); + return $m; + } + +/* +* str_to_noaccent(): remplace les lettres accentuées par leur équivalent sans accent +* +* entree $str (str) +* retourne $str (str) +* +* functions.php - clean_req_wiki() +*/ + +function str_to_noaccent($str) { + $str = preg_replace('#Ç#', 'C', $str); + $str = preg_replace('#ç#', 'c', $str); + $str = preg_replace('#è|é|ê|ë#', 'e', $str); + $str = preg_replace('#È|É|Ê|Ë#', 'E', $str); + $str = preg_replace('#à|á|â|ã|ä|å#', 'a', $str); + $str = preg_replace('#@|À|Á|Â|Ã|Ä|Å#', 'A', $str); + $str = preg_replace('#ì|í|î|ï#', 'i', $str); + $str = preg_replace('#Ì|Í|Î|Ï#', 'I', $str); + $str = preg_replace('#ð|ò|ó|ô|õ|ö#', 'o', $str); + $str = preg_replace('#Ò|Ó|Ô|Õ|Ö#', 'O', $str); + $str = preg_replace('#ù|ú|û|ü#', 'u', $str); + $str = preg_replace('#Ù|Ú|Û|Ü#', 'U', $str); + $str = preg_replace('#ý|ÿ#', 'y', $str); + $str = preg_replace('#Ý#', 'Y', $str); + + return ($str); +} + + +/* +* supprime_article(): supprime les articles en début d'expression +* +* +* entree $str (str) +* retourne $m (str) +* +* functions.php - clean_req_wiki() +*/ + +function supprime_article($str) { + //supprime les articles en début de chaine + //supprime expressions entre parentheses + + $pattern = "#^(le|la|les|un|une|du|de|des|ce|ces|cette|cet)\s#mUis"; + $pattern2 = "#^([l|d|s|t]')#mUis"; + //$pattern3 = "#\\([^)]*\\)#"; + + $k = preg_replace($pattern, " ", $str); + $l = preg_replace($pattern2, " ", $k); + return trim($l); + + //$m = preg_replace($pattern3, "", $l); + //return trim($m); +} + /* add_filter('the_content', 'exif_content', 20); diff --git a/header.php b/header.php index 082d27d..e1e3ee0 100644 --- a/header.php +++ b/header.php @@ -50,6 +50,7 @@ if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); ?> + @@ -60,12 +61,35 @@ */ wp_head(); ?> + + + @@ -73,9 +97,7 @@ - + diff --git a/js/child.js b/js/child.js index 98b4cc2..c2d63da 100755 --- a/js/child.js +++ b/js/child.js @@ -1,6 +1,8 @@ function toggleExif(id) { - /*alert(id);*/ - /**/id2 = id.toString(); + /**/ + //alert(id); + /**/ + id2 = id.toString(); var exifDiv = document.getElementById(id2); if (exifDiv.style.display == "block") { exifDiv.style.display = "none"; @@ -8,6 +10,11 @@ function toggleExif(id) { else { exifDiv.style.display = "block"; google.maps.event.trigger(map, 'resize'); + /* + var zoom = map.getZoom(); + map.setZoom( zoom ); + alert(zoom); + */ map.setZoom( map.getZoom() ); map.setCenter(marker.getPosition()); } diff --git a/loop-single.php b/loop-single.php index 7fe9938..00d215f 100644 --- a/loop-single.php +++ b/loop-single.php @@ -34,6 +34,10 @@ ', ']]>', $content); @@ -92,9 +96,9 @@ list($exif_list, $gm_lat, $gm_lng, $title_marker) = ListeExif($metadata, $attachment, $i); if ($gm_lat != "") { - $coord[$j]['lat'] = $gm_lat; - $coord[$j]['lng'] = $gm_lng; - $coord[$j]['mark'] = $title_marker; + $coord[$j][0] = $gm_lat; + $coord[$j][1] = $gm_lng; + $coord[$j][2] = $title_marker; $j++; } @@ -122,12 +126,25 @@ list($exif_list, $gm_lat, $gm_lng, $title_marker) = ListeExifZP($meta); if ($gm_lat != "") { - $coord[$j]['lat'] = $gm_lat; - $coord[$j]['lng'] = $gm_lng; - $coord[$j]['mark'] = str_replace("'", "\'", $title_marker); + $coord[$j][0] = $gm_lat; + $coord[$j][1] = $gm_lng; + $coord[$j][2] = str_replace("'", "\'", $title_marker); $j++; } - + + /* + locations[0] => $coord[2] => Titre (court) * + locations[1] => $coord[4] => Description (long) + locations[2] => $coord[0] => Latitude * + locations[3] => $coord[1] => Longitude * + locations[4] => $coord[5] => + locations[5] => $coord[8] => Texte Wikipedia + locations[6] => $coord[9] => Liens vers Wikipedia + $coord[3] => attachment + $coord[6] => requete wiki -> + $coord[7] => <- requete wiki + */ + //$new_img = $ancien . '
' . "\r\n"; $new_img = $ancien . "\r\n"; @@ -168,85 +185,298 @@ echo $content; - //preprint($coord); + //var_dump($coord); ?> -

 

+ + 0) ? "block" : "none") . ';">
'; + + //var_dump($coord); + + + + if (count($coord) > 0) { + + $b = array(); + + // Avec tous les titres, on crée la requete pour Wikipédia + + for ($a = 0; $a < count($coord); $a++){ + $short = $coord[$a][6]; // Titre + /* + Flickr: 2016-01-07_Renard_2905 + WP: + ZP: + */ + $b[] = $short; + } + + var_dump($b); + + //echo "coord avant requete Wikipedia"; + //var_dump($coord); + + $wiki = fmulticurl($b); + //var_dump($wiki); + + //On rajoute à $coord les données récupérées sur Wikipédia + + if (count($coord) == count($wiki)) { + for ($c = 0; $c < count($wiki); $c++){ + // [0] 1ere réponse, la plus pertinante + //array_push($coord[$c], $lettrine, $wiki[$c][1][0], $wiki[$c][2][0], $wiki[$c][3][0]); + // Requete - Texte Wikipedia - Url Wikipedia + array_push($coord[$c], $wiki[$c][1][0], $wiki[$c][2][0], $wiki[$c][3][0]); + //array_push($coord[$c], $wiki[$c][2][0], $wiki[$c][3][0]); + } + } + + //echo "coord après requete Wikipedia"; + //var_dump($coord); + ?> + + + + + +
+
"; + ?> + +
+ + + + + 0) ? "block" : "none") . ';">'; -?> - +?> + + '' ) ); ?> diff --git a/style.css b/style.css index 1aa8a46..16b5ae5 100644 --- a/style.css +++ b/style.css @@ -682,6 +682,7 @@ div.threewp_ajax_search_results_content ul li:hover .bloc_exif ul {list-style:none; padding:1em; background:#fff; border:solid #ddd; border-width:1px; } */ +/* #content .bloc_exif li {display:inline; padding-right:0.5em; font-size:0.857em; } @@ -708,4 +709,126 @@ div.threewp_ajax_search_results_content ul li:hover } .infowindow { width: 350px; -} \ No newline at end of file +} +*/ + + + +/* Exif */ + +.image-exif { + margin-right: auto; + margin-left: auto; + text-align: center; + margin-bottom: 32px; +} + +.exif-data { + display: inline-block; + margin-right: 16px; + font-size: 10px; +} +.cible i.ion-ios-location { + display: none; + color: green; + padding: 3px; +} +.cible i.ion-ios-location:hover { + color: #00b701; +} + +div#locations { + display: none; +} +button#hidemap { + display: none; + margin-bottom: 24px; + margin-top: 32px; +} +button#showmap { + margin-bottom: 24px; + margin-top: 32px; +} +div#center_marker { + width: 100%; + text-align: center; +} +ul.list_marker { + padding-left: 0; + margin: 2px auto; +} +/**/ +ul.list_marker a { + text-decoration: none; + color: green; +} +ul.list_marker a:hover { + color: #00b701; +} + +ul.list_marker li { + color: green !important; + } +ul.list_marker li:hover { + color: #00b701 !important; + font-weight: bold; +} + +.list_marker li { + display: inline; + font-size: 10px; + padding-right: 8px; + padding-left: 8px; + list-style-image: none; + text-align: center; +} + + +/* googlempa */ + +.infowindow, .gm-style-iw { + color: #5f5f5f; + font: normal normal 12px "Lucida Grande", Lucida, Verdana, sans-serif; +} + +.infowindow, .gm-style-iw a { + color: black; + text-decoration: underline; +} +.infowindow, .gm-style-iw img { + margin-top: 8px; + margin-left: 8px; +} + +#lettrineImage{ + float: left; + width: 220px; + height: 163px; + margin: 0 1em 1em 0; +} +#map { + width: 600px; + height: 400px; + display: none; + margin: 5em auto; +} +#gmap h1{ + font-family: Arial, Helvetica, sans-serif; + font-size: 1.6em; + font-style: italic; + font-weight: bold; + color:#267AA8; + text-align:center; + } +#gmap h2{ + margin-bottom:1em; + font-family: Arial, Helvetica, sans-serif; + font-size: 1.3em; + font-style: normal; + font-weight: bold; + color:#FF9900; + text-align:center; + } +#gmap p{ + font: 1em "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; +}