The Higher Education and Research forge

Home My Page Projects Code Snippets Project Openings MonLabo
Summary Activity Tracker Tasks Docs SCM Files Dokuwiki Continious Integration Listes Sympa

SCM Repository

authorherve <herve.suaudeau@parisdescartes.fr>
Mon, 5 Oct 2020 18:55:47 +0000 (20:55 +0200)
committerherve <herve.suaudeau@parisdescartes.fr>
Mon, 5 Oct 2020 18:55:47 +0000 (20:55 +0200)
admin/includes/inc-lib-forms-processing.php
admin/includes/inc-lib-forms.php
admin/includes/inc-lib-tables.php
admin/js/MonLabo-admin.js
changelog.txt
includes/MonLabo-generate-HTML.php
includes/MonLabo-lib.php
mon-laboratoire.php

index f218da1..431624f 100644 (file)
@@ -329,7 +329,6 @@ function form_edit_team_processing() {
        $team_id = 0;
        //Vérification que le formulaire a bien été soumis
        if ( isset( $_POST['submit_name_fr'] ) ) {
-               unset( $_POST['not_used'] );
                $team_id = intval( $_POST['submit_id'] );
                unset( $_POST['submit_id'] );
                $action = sanitize_key( $_POST['action'] );
@@ -366,7 +365,6 @@ function form_edit_team_processing() {
                                        //Si aucune thematique n'est renseignée, bien passer un tableau vide.
                                        $data['thematics'] = array();
                                }
-
                                if ( 0 === $team_id ) { // ajout d'une équipe
                                        // Création de la ligne dans la table MonLabo_teams
                                        $team_id_if_created = $MonLabo_access_data->insert_team( $data );
@@ -412,7 +410,6 @@ function form_edit_thematic_processing() {
        $thematic_id = 0;
        //Vérification que le formulaire a bien été soumis
        if ( isset( $_POST['submit_name_fr'] ) ) {
-               unset( $_POST['not_used'] );
                $thematic_id = intval( $_POST['submit_id'] );
                unset( $_POST['submit_id'] );
                $action = sanitize_key( $_POST['action'] );
@@ -471,7 +468,6 @@ function form_edit_unite_processing() {
        $unite_id = 0;
        //Vérification que le formulaire a bien été soumis
        if ( isset( $_POST['submit_name_fr'] ) ) {
-               unset( $_POST['not_used'] );
                $unite_id = intval( $_POST['submit_id'] );
                unset( $_POST['submit_id'] );
                $action = sanitize_key( $_POST['action'] );
@@ -541,7 +537,6 @@ function form_edit_unite_processing() {
 function form_edit_structure_principale_processing() {
        //Vérification que le formulaire a bien été soumis
        if ( isset( $_POST['submit_nom'] ) ) {
-               unset( $_POST['not_used'] );
                //Security verification by nonce
                if( check_admin_referer( 'edit_structure_principale_form', 'edit_structure_principale_form_wpnonce' ) ) {
                        unset( $_POST['edit_structure_principale_form_wpnonce'] );
index 1eda00e..d3f4eb5 100644 (file)
@@ -338,21 +338,25 @@ function generate_color_form( $isMandatory, $legend, $name, $description, $valeu
 }
 
 function generate_square_image_form( $isMandatory, $legend, $name, $description, $valeur_initiale, $id ) {
+       $MonLabo_generate_HTML = New MonLabo_generate_HTML;
        $retval = '<div class="input-group"><label for="'.$name.'">'.$description.'&nbsp;: </label>';
        $retval .= '<input id="'.$name.'_no_logo_button" class="button" value="'.__( "Aucun", 'mon-laboratoire' ).'"';
        $retval .= ' onclick="selectNoPicture(\''.$name.'-image-preview\', \''.$name.'\', \''.$name.'-image_attachment_id\');" type="button" />';
        $retval .= '&nbsp;<input id="'.$name.'_upload_image_button" type="button" class="button" value="'. __( 'Choisir média', 'mon-laboratoire' ).'"';
-       $retval .= ' onclick="imageMediaMenu(\''. __( 'Choisir une image', 'mon-laboratoire' ).'\',\''. __( 'utiliser cette image', 'mon-laboratoire' ).'\', ';
-       $retval .=                                                       '\''.$name.'-image-preview\', \''.$name.'-image_attachment_id\');" />';
-       $retval .= "<input type='hidden' name='not_used' id='".$name."-image_attachment_id' value='0' />";
-       if ( !empty( $valeur_initiale ) ) {
-               $retval .= "&nbsp;<a href='#' class='hover-zoom-square30'><img width='30' height='30' id='".$name."-image-preview' class='wp-image-8 wp-post-image' src='".$valeur_initiale."' alt='".$valeur_initiale."'></a>";
-       }
-       $retval .= '</div><div class="hidden">'.generate_champ_formulaire_pub( $name, $isMandatory, '', get_MonLabo_Team_fields_comments( $name ), $valeur_initiale, $name ).'</div>';
+       $retval .= ' onclick="imageMediaMenu('
+               . '\'' . __( 'Choisir une image', 'mon-laboratoire' ).'\','
+               . '\'' . __( 'utiliser cette image', 'mon-laboratoire' ).'\','
+               . '\'' . $name.'-image-preview\','
+               . '\'' . $name.'\''
+               . ');" />';
+       $retval .= "<input type='hidden' name='".$name."' id='".$name."' value='".$valeur_initiale."' />&nbsp;";
+       $retval .= $MonLabo_generate_HTML->image_from_id_or_url( $valeur_initiale,
+               array("image_id" => $name."-image-preview", "href" => "#", "a_class" => "hover-zoom-square30", "hide_if_empty" => "true" )
+        );
+       $retval .= '</div>';
        return $retval;
 }
 
-
 function generate_submit_button( $text, $id = '', $on_click = '' ) {
        $id_text = '';
        if ( '' != $id ) {
@@ -425,7 +429,7 @@ function generate_update_member_thumbnail( $person_id, $page_number, $wp_post_id
                        }
                }
                if (!empty( $other_persons_name_for_this_page )) {
-                       $retval .= '<br /><strong>Attention cette page est déjà attribuée à </strong>'. implode(", ", $other_persons_name_for_this_page);
+                       $retval .= '<br /><strong>Attention cette page est déjà attribuée à </strong>'. MonLaboLib::secured_implode(", ", $other_persons_name_for_this_page);
                }
                $retval .= '</div>';
        }
index 450ca26..13447bd 100644 (file)
@@ -147,7 +147,9 @@ function generate_table_admin_for_teams() {
                        $team_array['id'] = $team_information->id;
                        $team_array['name_fr'] = '<small>'.$team_information->name_fr.'</small>';
                        $team_array['name_en'] = '<small>'.$team_information->name_en.'</small>';
-                       $team_array['logo'] = ( empty( $team_information->logo ) ? '' : '<a href="'.$team_information->logo.'" class="hover-zoom-square30"><img src="'.$team_information->logo.'" height="24" alt="'.$team_information->logo.'" /></a>' );
+                       $team_array['logo'] = $generate_HTML->image_from_id_or_url( $team_information->logo,
+                               array("href" => "#", "a_class" => "hover-zoom-square30", "width" => 24, "height" =>24 )
+                        );
                        if ( !empty( $team_information->wp_post_id ) ) {
                                $teams_links = Array();
                                foreach ( explode( ', ', $team_information->wp_post_id ) as $id ) {
@@ -221,7 +223,9 @@ function generate_table_admin_for_thematics() {
                        $thematic_array['id'] = $thematic_information->id;
                        $thematic_array['name_fr'] = '<small>'.$thematic_information->name_fr.'</small>';
                        $thematic_array['name_en'] = '<small>'.$thematic_information->name_en.'</small>';
-                       $thematic_array['logo'] = ( empty( $thematic_information->logo ) ? '' : '<a href="'.$thematic_information->logo.'" class="hover-zoom-square30"><img src="'.$thematic_information->logo.'" height="24" alt="'.$thematic_information->logo.'" /></a>' );
+                       $thematic_array['logo'] = $generate_HTML->image_from_id_or_url( $thematic_information->logo,
+                               array("href" => "#", "a_class" => "hover-zoom-square30", "width" => 24, "height" =>24 )
+                        );
                        $thematic_array['external_url'] = ( empty( $thematic_information->external_url ) ? '' : '<a href="'.$thematic_information->external_url.'">'.__( 'lien', 'mon-laboratoire' ).'</a>' );
                        $thematic_array['hal_publi_thematic_id'] = $thematic_information->hal_publi_thematic_id;
                        $teams_information = $MonLabo_access_data->get_teams_information_for_a_thematic( $thematic_information->id );
@@ -290,7 +294,9 @@ function generate_table_admin_for_units() {
                        $unit_array['id'] = $unit_information->id;
                        $unit_array['name_fr'] = '<small>'.$unit_information->name_fr.'</small>';
                        $unit_array['name_en'] = '<small>'.$unit_information->name_en.'</small>';
-                       $unit_array['logo'] = ( empty( $unit_information->logo ) ? '' : '<a href="'.$unit_information->logo.'" class="hover-zoom-square30"><img src="'.$unit_information->logo.'" height="24" alt="'.$unit_information->logo.'" /></a>' );
+                       $unit_array['logo'] = $generate_HTML->image_from_id_or_url( $unit_information->logo,
+                               array("href" => "#", "a_class" => "hover-zoom-square30", "width" => 24, "height" =>24 )
+                        );
                        $unit_array['code'] = $unit_information->code;
                        $unit_array['affiliations'] = '<small>'.$unit_information->affiliations.'</small>';
                        $unit_array['external_url'] = ( empty( $unit_information->external_url ) ? '' : '<a href="'.$unit_information->external_url.'">'.__( 'lien', 'mon-laboratoire' ).'</a>' );
index 5731d96..9a37a67 100644 (file)
@@ -162,7 +162,8 @@ function imageMediaMenu(
        titleText = 'Images',
        buttonText = 'OK',
        imagePreviewFieldId = 'image-preview',
-       imageAttachementIdFieldId = 'image_attachment_id'
+       imageAttachementIdFieldId = 'image_attachment_id',
+    //imageAttachementUrlFieldId = 'image_attachment_url'
  ) {
 
        // Creates the media frame.
@@ -190,6 +191,7 @@ function imageMediaMenu(
                // Does something with attachment.id and/or attachment.url here
                jQuery( '#' + imagePreviewFieldId ).attr( 'src', urlThubmnail ).css( 'width', 'auto' );
                jQuery( '#' + imagePreviewFieldId ).removeAttr( 'srcset' ); //Id of image to display (<img id=...)
+        jQuery( '#' + imagePreviewFieldId ).show(); //Id of image to display (<img id=...)
                //jQuery( '#' + imageAttachementUrlFieldId ).val( urlThubmnail ); //URL of picture. Ex: https://url/pic.jpg
                jQuery( '#' + imageAttachementIdFieldId ).val( attachment.id );
        });
@@ -244,9 +246,10 @@ function selectNoPicture( imagePreviewFieldId = 'image-preview',
        imageAttachementUrlFieldId = 'image_attachment_url',
        imageAttachementIdFieldId = 'image_attachment_id' ) {
        jQuery( '#' + imageAttachementUrlFieldId ).val( '' );
-       jQuery( '#' + imageAttachementIdFieldId ).val( '' );
+    jQuery( '#' + imageAttachementIdFieldId ).val( '' );
        jQuery( '#' + imagePreviewFieldId ).attr( 'src', '' ).css( 'width', 'auto' );
        jQuery( '#' + imagePreviewFieldId ).removeAttr( 'srcset' );
+    jQuery( '#' + imagePreviewFieldId ).hide();
 }
 
 /**
index f0047c9..5aeb9df 100644 (file)
@@ -19,7 +19,6 @@ Voici un fichier avec les TODO et les changelog complets.
 * ÉVOL: Exporte et importe les personnels, équipes et structure.
 * BUG: Interdire personnel dans aucune équipe
 * BUG (minueur) :  Retour de ligne excessif au niveau du logo du PDF d'une publication de HAL au format hal (pas présent au format apa et ieee)
-* ÉVOL: Forcer la migration sans passer par une page configuration.
 * ÉVOL: Pouvoir avec HAL faire des requêtes avec des idHal et des struct en même temps (ou consécutivement et fusionnées)
 * ÉVOL: Ajouter l'option unit à [teams_list]
 * ÉVOL: Ajout des dispositions légales: https://annuaire.cnrs.fr/l3c/owa/annuaire.recherche/index.html
@@ -78,7 +77,6 @@ Remember, check_admin_referer alone is not bulletproof security. Do not rely on
 == Changelog ==
 
 = 3.1 =
-===> Suppression champs inutiles dans table Persons
 ===> Vérifier que la gestion des logos des équipes, unités et autre sont bien gérés.
 * EVOL: A person can have several pages
 * CODE : Secure ajax code with a nonce to prevent unauthorized access
index e2ae6fa..2eb0956 100644 (file)
@@ -7,18 +7,28 @@ class MonLabo_generate_HTML {
        //General LIBRAIRY
        obsfuscate_emails_separated_by_comma ( $emails )                                                                                                   DONE
        obsfuscate_email ( $email )                                                                                                DONE
+       transform__wp_post_id__into_url ( $wp_post_id )
 
        //Extract person's items
        person_name ( $person_information )                                                                                DONE TESTED
        person_name_with_admin_link ( $person_information )
+       team_name_in_html  ( $team_information, $language, $with_logo )
        person_teams_enumeration ( $person_information, $langage, $separator=', ' )   DONE TESTED
+       person_address_HTML( $person_information, $language )
+       person_thumbnail ( $person_information, $width = 70, $height = 70, $class = 'wp-image-6 alignleft img-arrondi' ) {
 
        //Build sets of persons
-       persons_list( $title_single, $title_plural, $persons_information, $language ) DONE TESTED
-       persons_table_compact_column ( $persons_information, $title, $language ) DONE TESTED
+       persons_chart( $unit_name, $directors, $teams_information, $persons_information_by_category_and_team, $language )
        persons_table_normal ( $main_title, $colums_titles, $persons_information, $language, $titles_color, $status )   DONE TESTED
+       persons_table_compact_column ( $persons_information, $title, $language ) DONE TESTED
+       persons_list( $title_single, $title_plural, $persons_information, $language ) DONE TESTED
+       teams_list( $thematic, $teams_information, $teams_leaders, $thematics_information, $teams_publications_page, $language )
+
+       //Build panels
+       generate_HTML_person_small_panel( $person_information, $language, $picture = '' )
        person_panel ( $person_information, $teams_id, $mentors_information, $students_information, $language ) DONE TESTED
        team_panel ( $team_information, $leaders_information, $thematics_name, $language, $color )
+       alumni_function( $person_information, $language )
 
        //Generic functions
        generic_table ( $main_title, $colums_titles, $HTML_content_array, $column_titles_color, $table_title_color );              DONE TESTED
@@ -50,7 +60,7 @@ class MonLabo_generate_HTML {
                                        $emails_obfuscated[] = $this->obsfuscate_email( trim ( $email ) );
                                }
                        }
-                       $html = implode( ", ",  $emails_obfuscated);
+                       $html = MonLaboLib::secured_implode( ", ",  $emails_obfuscated);
                }
                return $html;
        }
@@ -173,8 +183,11 @@ class MonLabo_generate_HTML {
                $wp_post_ids = explode( ',', $team_information->wp_post_id );
                $wp_post_id = $wp_post_ids[0];
                // Prepare picture of the team
-               if ( ( '' != $team_information->logo ) && $with_logo ) {
-                       $team_logo = "<img src='".$team_information->logo."' class='wp-image-8 alignleft wp-post-image team_logo' height='70' width='70' alt=' ' />";
+
+               if ( $with_logo ) {
+                       $team_logo = $this->image_from_id_or_url( $team_information->logo,
+                               array( "img_class" => 'wp-image-8 alignleft wp-post-image team_logo', "width" => 70, "height" =>70, "alt" => ' ' )
+                        );
                } else {
                        $team_logo = '';
                }
@@ -189,7 +202,7 @@ class MonLabo_generate_HTML {
                 * acronyme des noms d'équipes ( LISSI )
                $masque = '/[A-Z]/';
                preg_match_all( $masque, $team_information->$name, $matches );
-               $team_name_abbreviated = implode( '', $matches[0] );
+               $team_name_abbreviated = MonLaboLib::secured_implode( '', $matches[0] );
                */
                $team_name_abbreviated = MonLaboLib::to_html( $team_information->$name );
                if ( '' != $href ) {
@@ -299,6 +312,19 @@ class MonLabo_generate_HTML {
        }
 
 
+       function person_thumbnail( $person_information, $width = 70, $height = 70, $class = 'wp-image-6 alignleft img-arrondi' ) {
+               $options2 = get_option( 'MonLabo_settings_group2' );
+               $image = get_the_post_thumbnail( $person_information->wp_post_id, array( $width, $height ), array( 'class'      => $class ) );
+               if ( '' === $image ) { //If no exist display a dummy face
+                       if ( ( !is_numeric( $person_information->wp_post_id ) ) and ( !empty( $person_information->alternate_image ) ) ) {
+                               $image_url = $person_information->alternate_image;
+                       } else {
+                               $image_url = $options2['MonLabo_img_par_defaut'];
+                       }
+                       $image = '<img src="'.$image_url.'" class="'.$class.' wp-post-image" height="'.$height.'" width="'.$width.'" alt=" " />';
+               }
+               return $image;
+       }
 
        /*
         * Crée le code HTML d'un organigramme crée à partir des Informations
@@ -593,9 +619,17 @@ class MonLabo_generate_HTML {
                                        $logos_other_thematics .= "<div class='teams-list-other-thematics-logos'>";
                                        foreach ( $thematics_information[$team_information->id] as $other_thematic ) {
                                                if ( $other_thematic->id != $thematic ) {
-                                                       $logos_other_thematics .= "<a href='".$other_thematic->external_url."' class='MonLaboLink' title='Other thematic of the team : ";
-                                                       $logos_other_thematics .= MonLaboLib::to_html( $other_thematic->$nom )."'><img src='".$other_thematic->logo;
-                                                       $logos_other_thematics .= "' class='thematics_logo' alt=' '></a>";
+                                                       //$logos_other_thematics .= "<a href='".$other_thematic->external_url."' class='MonLaboLink' title='Other thematic of the team : ";
+                                                       //$logos_other_thematics .= MonLaboLib::to_html( $other_thematic->$nom )."'>";
+                                                       $logos_other_thematics .= $this->image_from_id_or_url( $other_thematic->logo,
+                                                               array(
+                                                                       "a_class" => 'MonLaboLink',
+                                                                       "href"=> $other_thematic->external_url,
+                                                                       "img_class" => 'thematics_logo',
+                                                                       "alt" => " ",
+                                                                       "title" => 'Other thematic of the team : '. MonLaboLib::to_html( $other_thematic->$nom ) )
+                                                       );
+                                                       $logos_other_thematics .= "</a>";
                                                }
                                        }
                                        $logos_other_thematics .= '</div>';
@@ -605,7 +639,7 @@ class MonLabo_generate_HTML {
                                if ( !empty( $teams_leaders ) ) {
                                        if ( !empty( $team_information ) ) {
                                                if ( !empty( $teams_leaders[$team_information->id] ) ) {
-                                                       $a_afficher .=  'Direction : ' . MonLaboLib::to_html( implode( ' & ', $teams_leaders[$team_information->id] ) );
+                                                       $a_afficher .=  'Direction : ' . MonLaboLib::to_html( MonLaboLib::secured_implode( ' & ', $teams_leaders[$team_information->id] ) );
                                                }
                                        }
                                }
@@ -662,7 +696,7 @@ class MonLabo_generate_HTML {
                        //Prepare picture of the user
                        //---------------------------
                        if ( '' === $picture ) {
-                               $image = $this->get_the_person_thumbnail( $person_information, 70, 70, 'wp-image-8 alignleft img-arrondi' );
+                               $image = $this->person_thumbnail( $person_information, 70, 70, 'wp-image-8 alignleft img-arrondi' );
                        } else {
                                $image = '<img src="'.$picture.'" class="wp-image-8 alignleft img-arrondi wp-post-image" height="70" width="70" alt=" " />';
                        }
@@ -707,7 +741,7 @@ class MonLabo_generate_HTML {
                        if ( ( !$is_alumni ) && ( !empty( $person_information->room ) ) ) {
                                $list_to_display[] = MonLaboLib::to_html( MonLabo_translate::translate( 'room', $language ) .' ' . $person_information->room );
                        }
-                       $a_afficher .= implode( ', ', $list_to_display ); //On met des virgules entre chaque item
+                       $a_afficher .= MonLaboLib::secured_implode( ', ', $list_to_display ); //On met des virgules entre chaque item
                        $a_afficher.= '</div></div>';
                }
                return $a_afficher;
@@ -808,19 +842,6 @@ class MonLabo_generate_HTML {
                return $a_afficher;
        }
 
-       function get_the_person_thumbnail( $person_information, $width = 70, $height = 70, $class = 'wp-image-6 alignleft img-arrondi' ) {
-               $options2 = get_option( 'MonLabo_settings_group2' );
-               $image = get_the_post_thumbnail( $person_information->wp_post_id, array( $width, $height ), array( 'class'      => $class ) );
-               if ( '' === $image ) { //If no exist display a dummy face
-                       if ( ( !is_numeric( $person_information->wp_post_id ) ) and ( !empty( $person_information->alternate_image ) ) ) {
-                               $image_url = $person_information->alternate_image;
-                       } else {
-                               $image_url = $options2['MonLabo_img_par_defaut'];
-                       }
-                       $image = '<img src="'.$image_url.'" class="'.$class.' wp-post-image" height="'.$height.'" width="'.$width.'" alt=" " />';
-               }
-               return $image;
-       }
 
        /**
         * Crée le code HTML d'un bandeau de page personnelle
@@ -852,7 +873,7 @@ class MonLabo_generate_HTML {
                $external_url = $person_information->external_url;
                $options2 = get_option( 'MonLabo_settings_group2' );
 
-               $image = $this->get_the_person_thumbnail( $person_information, 150, 150, 'wp-image-6 alignleft img-arrondi' );
+               $image = $this->person_thumbnail( $person_information, 150, 150, 'wp-image-6 alignleft img-arrondi' );
                //Generate HTML
                //------------
                $a_afficher = '';
@@ -1036,4 +1057,58 @@ class MonLabo_generate_HTML {
                $a_afficher .= '</div>';
                return $a_afficher;
        }
+
+       /**
+        * Create HTML code of an image from an image ID or URL (autodetect)
+        *
+        * @param string $id_or_url value that can be either an URL or a WordPress image ID
+        * @param  array $imagedata array of facultative parameters
+        *  'image_id' => ID of the image
+        *  'href' => link of of surrounding <a> (no link if empty)
+        *  'a_class' => class of surrounding <a>
+        *  'img_class' => class of <img>
+        *  'width width' => of the image in pixels
+        *  'height' => height of the image in pixels
+        *  'alt' => alt fielf of <img>
+        *  'title' => title fielf of <a>
+        *  'default_image' => iamge to display if $id_or_url empty
+        *
+        * @return string code HTML
+        */
+       function image_from_id_or_url( $id_or_url, $imagedata ){
+               $a_class                = empty( $imagedata['a_class'] )                ? '' : $imagedata['a_class'];
+               $href                   = empty( $imagedata['href'] )                   ? '' : $imagedata['href'];
+               $image_id               = empty( $imagedata['image_id'] )               ? uniqid() : $imagedata['image_id'];
+               $img_class              = empty( $imagedata['img_class'] )              ? "wp-image-8 wp-post-image" : $imagedata['img_class'];
+               $width                  = empty( $imagedata['width'] )                  ? 30 : $imagedata['width'];
+               $height                 = empty( $imagedata['height'] )                 ? 30 : $imagedata['height'];
+               $default_image  = empty( $imagedata['default_image'] )  ? '' : $imagedata['default_image'];
+               $alt                    = empty( $imagedata['alt'] )                    ? $id_or_url : $imagedata['alt'];
+               $title                  = empty( $imagedata['title'] )                  ? '' : " title='" . $imagedata['title'] . "'";
+               $default_image  = empty( $imagedata['default_image'] )  ? '' : $imagedata['default_image'];
+               $hide_if_empty  = empty( $imagedata['hide_if_empty'] )  ? false : $imagedata['hide_if_empty'];
+
+               $html = "";
+               $supl_class = "";
+               if( empty( $id_or_url ) ) {
+                       $url = $default_image;
+                       if ( empty($default_image)  ) {
+                               $supl_class=" hidden";
+                       }
+               } elseif ( is_numeric( $id_or_url ) ) {
+                       $url = wp_get_attachment_image_src( $id_or_url, array( $width, $height ) )[0];
+               } else {
+                       $url = $id_or_url;
+               }
+               if( ( !empty( $url ) ) or $hide_if_empty ) {
+                       if( !empty( $href ) ) {
+                               $html .= "<a href='" . $href . "' class='" . $a_class . "'".$title.">";
+                       }
+                       $html .= "<img width='" . $width . "' height='" . $height . "' id='" . $image_id . "' class='" . $img_class . $supl_class."' src='".$url."' alt='".$alt."'>";
+                       if( !empty( $href ) ) {
+                               $html .= '</a>';
+                       }
+               }
+               return $html;
+       }
 }
index 2b1d59d..5562c6d 100644 (file)
@@ -1,8 +1,30 @@
 <?php
 defined( 'ABSPATH' ) or die( 'No direct script access allowed' );
 
-/**
- * Class MonLabo_persons
+/* Class MonLaboLib {
+
+       //Manage arrays
+       secured_array_keys( $array )
+       secured_implode( $separation, $array )
+       prepare_multiple_values_variable_into_array( $inputs )
+       first_key_of_array( $myarray )
+
+       //manage strings
+       get_phone_with_prefix( $phone, $html_strong_extension = 'false' )
+       strtoupper_to_html( $string )
+       to_html( $string )
+       sansaccent_et_en_minuscule($chaine)
+       generate_french_index_alphabetic_order( $string )
+
+       //various
+       get_current_url_without_queries()
+       polylang_plugin_status()
+       get_file_url( $file )
+       number_of_persons_proprietary_for_a_page( $page_id )
+*/
+
+ /**
+  * Class MonLaboLib
  *
  * @package
  */
index fd76232..141af20 100644 (file)
@@ -170,12 +170,6 @@ if ( !class_exists( 'MonLabo' ) ) {
  * This action is documented in includes/class-plugin-name-activator.php
  */
 function activate_MonLabo() {
-
-       /*echo("<pre>");
-       var_dump(get_option( 'MonLabo_settings_group0' ));
-       var_dump(get_option( 'MonLabo_settings_group5' ));
-       echo("</pre>");*/
-
        $MonLabo_DB = New MonLabo_db();
        $options0 = get_option( 'MonLabo_settings_group0' );
        if( $MonLabo_DB->check_tables_exist() ) {