Ejemplo n.º 1
0
 public function ouvrir($nom_config, $en_ligne)
 {
     $xml_analitix = new xml_struct();
     $ret = $xml_analitix->ouvrir(_XML_PATH . _XML_ANALITIX . _XML_EXT);
     if ($ret) {
         // Traitement de la configuration
         $nb_config = $xml_analitix->compter_elements(_ANALITIX_CONFIG);
         $xml_analitix->pointer_sur_balise(_ANALITIX_CONFIG);
         $xml_analitix->creer_repere(_ANALITIX_CONFIG);
         for ($cpt = 0; $cpt < $nb_config; $cpt++) {
             $xml_analitix->pointer_sur_repere(_ANALITIX_CONFIG);
             $xml_analitix->pointer_sur_index($cpt);
             $nom_attr = (string) $xml_analitix->lire_attribut(_XML_NOM);
             if (!strcmp($nom_config, $nom_attr)) {
                 $this->nom_config = $nom_config;
                 $this->nom_fitre_ip = $xml_analitix->lire_n_valeur(_ANALITIX_CONFIG_FILTRE_IP, $cpt);
                 $this->nom_fitre_pays = $xml_analitix->lire_n_valeur(_ANALITIX_CONFIG_FILTRE_PAYS, $cpt);
                 $this->nom_fitre_ref = $xml_analitix->lire_n_valeur(_ANALITIX_CONFIG_FILTRE_REFERENTS, $cpt);
                 $param_anonymisation = strtolower(trim($xml_analitix->lire_n_valeur(_ANALITIX_CONFIG_ANONYMISATION_IP, $cpt)));
                 $this->anonymisation_ip = strcmp($param_anonymisation, _XML_FALSE) ? true : false;
                 $param_dnt = strtolower(trim($xml_analitix->lire_n_valeur(_ANALITIX_CONFIG_RESPECT_DNT, $cpt)));
                 $this->respect_dnt = strcmp($param_dnt, _XML_FALSE) ? true : false;
                 break;
             }
         }
         // Traitement des listes d'IP
         if (strlen($this->nom_fitre_ip) > 0) {
             $xml_analitix->pointer_sur_origine();
             $nb_liste_ip = $xml_analitix->compter_elements(_ANALITIX_LISTE_IP);
             $xml_analitix->pointer_sur_balise(_ANALITIX_LISTE_IP);
             $xml_analitix->creer_repere(_ANALITIX_LISTE_IP);
             for ($cpt = 0; $cpt < $nb_liste_ip; $cpt++) {
                 $xml_analitix->pointer_sur_repere(_ANALITIX_LISTE_IP);
                 $xml_analitix->pointer_sur_index($cpt);
                 $nom_attr = (string) $xml_analitix->lire_attribut(_XML_NOM);
                 if (!strcmp($this->nom_fitre_ip, $nom_attr)) {
                     $nb_ip = $xml_analitix->compter_elements(_ANALITIX_IP);
                     for ($cpt_ip = 0; $cpt_ip < $nb_ip; $cpt_ip++) {
                         $valeur = $xml_analitix->lire_valeur_n(_ANALITIX_IP, $cpt_ip);
                         $this->liste_ip[] = $valeur;
                     }
                     break;
                 }
             }
         }
         // Traitement des listes de pays
         if (strlen($this->nom_fitre_pays) > 0) {
             $xml_analitix->pointer_sur_origine();
             $nb_liste_pays = $xml_analitix->compter_elements(_ANALITIX_LISTE_PAYS);
             $xml_analitix->pointer_sur_balise(_ANALITIX_LISTE_PAYS);
             $xml_analitix->creer_repere(_ANALITIX_LISTE_PAYS);
             for ($cpt = 0; $cpt < $nb_liste_pays; $cpt++) {
                 $xml_analitix->pointer_sur_repere(_ANALITIX_LISTE_PAYS);
                 $xml_analitix->pointer_sur_index($cpt);
                 $nom_attr = (string) $xml_analitix->lire_attribut(_XML_NOM);
                 if (!strcmp($this->nom_fitre_pays, $nom_attr)) {
                     $nb_pays = $xml_analitix->compter_elements(_ANALITIX_PAYS);
                     for ($cpt_pays = 0; $cpt_pays < $nb_pays; $cpt_pays++) {
                         $valeur = $xml_analitix->lire_valeur_n(_ANALITIX_PAYS, $cpt_pays);
                         $this->liste_pays[] = $valeur;
                     }
                     break;
                 }
             }
         }
         // Traitement des listes de référents
         if (strlen($this->nom_fitre_ref) > 0) {
             $xml_analitix->pointer_sur_origine();
             $nb_liste_ref = $xml_analitix->compter_elements(_ANALITIX_LISTE_REFERENTS);
             $xml_analitix->pointer_sur_balise(_ANALITIX_LISTE_REFERENTS);
             $xml_analitix->creer_repere(_ANALITIX_LISTE_REFERENTS);
             for ($cpt = 0; $cpt < $nb_liste_ref; $cpt++) {
                 $xml_analitix->pointer_sur_repere(_ANALITIX_LISTE_REFERENTS);
                 $xml_analitix->pointer_sur_index($cpt);
                 $nom_attr = (string) $xml_analitix->lire_attribut(_XML_NOM);
                 if (!strcmp($this->nom_fitre_ref, $nom_attr)) {
                     $nb_ref = $xml_analitix->compter_elements(_ANALITIX_REFERENT);
                     for ($cpt_ref = 0; $cpt_ref < $nb_ref; $cpt_ref++) {
                         $valeur = $xml_analitix->lire_valeur_n(_ANALITIX_REFERENT, $cpt_ref);
                         $this->liste_ref[] = filter_var($valeur, FILTER_SANITIZE_URL);
                     }
                     break;
                 }
             }
         }
     }
     return $ret;
 }
Ejemplo n.º 2
0
 public function ouvrir($nom)
 {
     $xml_site = new xml_struct();
     $ret = $xml_site->ouvrir($nom);
     if ($ret) {
         // Lecture des modules
         $nb_modules = $xml_site->compter_elements(_SITE_MODULE);
         for ($cpt_module = 0; $cpt_module < $nb_modules; $cpt_module++) {
             $module = $xml_site->lire_valeur_n(_SITE_MODULE, $cpt_module);
             $this->modules[] = $module;
         }
         // Lecture des langues
         $nb_langues = $xml_site->compter_elements(_SITE_LANGUE);
         for ($cpt_langue = 0; $cpt_langue < $nb_langues; $cpt_langue++) {
             $code_langue = $xml_site->lire_valeur_n(_SITE_LANGUE, $cpt_langue);
             $this->codes_langues[] = $code_langue;
         }
         // Lecture du plan du site
         $has_plan = $xml_site->compter_elements(_SITE_PLAN) > 0;
         if ($has_plan) {
             $xml_site->pointer_sur_balise(_SITE_PLAN);
             $nb_pages = $xml_site->compter_elements(_SITE_PLAN_PAGE);
             $xml_site->pointer_sur_balise(_SITE_PLAN_PAGE);
             $cpt_ref = 0;
             for ($cpt = 0; $cpt < $nb_pages; $cpt++) {
                 $ref = $xml_site->lire_n_attribut(_SITE_PLAN_PAGE_ATTR_REF, $cpt);
                 if (strlen($ref) > 0) {
                     $nom = $xml_site->lire_n_valeur(_SITE_PLAN_PAGE_NOM, $cpt);
                     $touche = $xml_site->lire_n_valeur(_SITE_PLAN_PAGE_TOUCHE, $cpt);
                     $parent = $xml_site->lire_n_valeur(_SITE_PLAN_PAGE_PARENT, $cpt);
                     $this->plan[$cpt_ref][_SITE_PLAN_PAGE_ATTR_REF] = $ref;
                     $this->plan[$cpt_ref][_SITE_PLAN_PAGE_NOM] = $nom;
                     $this->plan[$cpt_ref][_SITE_PLAN_PAGE_TOUCHE] = $touche;
                     $this->plan[$cpt_ref][_SITE_PLAN_PAGE_PARENT] = $parent;
                     $cpt_ref += 1;
                 }
             }
             $xml_site->pointer_sur_origine();
         }
         // Liens sociaux
         $lien = $xml_site->lire_valeur(_SITE_SOCIAL_FACEBOOK);
         if (strlen($lien) > 0) {
             $this->social[_SITE_SOCIAL_FACEBOOK] = $lien;
         }
         $lien = $xml_site->lire_valeur(_SITE_SOCIAL_TWITTER);
         if (strlen($lien) > 0) {
             $this->social[_SITE_SOCIAL_TWITTER] = $lien;
         }
         $lien = $xml_site->lire_valeur(_SITE_SOCIAL_GOOGLE_PLUS);
         if (strlen($lien) > 0) {
             $this->social[_SITE_SOCIAL_GOOGLE_PLUS] = $lien;
         }
         $lien = $xml_site->lire_valeur(_SITE_SOCIAL_PINTEREST);
         if (strlen($lien) > 0) {
             $this->social[_SITE_SOCIAL_PINTEREST] = $lien;
         }
         $lien = $xml_site->lire_valeur(_SITE_SOCIAL_TUMBLR);
         if (strlen($lien) > 0) {
             $this->social[_SITE_SOCIAL_TUMBLR] = $lien;
         }
         $lien = $xml_site->lire_valeur(_SITE_SOCIAL_INSTAGRAM);
         if (strlen($lien) > 0) {
             $this->social[_SITE_SOCIAL_INSTAGRAM] = $lien;
         }
         $lien = $xml_site->lire_valeur(_SITE_SOCIAL_LINKEDIN);
         if (strlen($lien) > 0) {
             $this->social[_SITE_SOCIAL_LINKEDIN] = $lien;
         }
         $lien = $xml_site->lire_valeur(_SITE_SOCIAL_YOUTUBE);
         if (strlen($lien) > 0) {
             $this->social[_SITE_SOCIAL_YOUTUBE] = $lien;
         }
         $lien = $xml_site->lire_valeur(_SITE_SOCIAL_FLICKR);
         if (strlen($lien) > 0) {
             $this->social[_SITE_SOCIAL_FLICKR] = $lien;
         }
         // Autres éléments du fichier general.xml
         $this->ins_url_racine($xml_site->lire_valeur(_SITE_RACINE));
         $this->ins_proprietaire($xml_site->lire_valeur(_SITE_PROPRIETAIRE));
         $this->ins_adresse($xml_site->lire_valeur(_SITE_ADR_PROPRIETAIRE));
         $this->ins_telephone($xml_site->lire_valeur(_SITE_TEL_PROPRIETAIRE));
         $this->ins_rcs($xml_site->lire_valeur(_SITE_RCS_PROPRIETAIRE));
         $this->ins_siret($xml_site->lire_valeur(_SITE_SIRET_PROPRIETAIRE));
         $this->ins_redacteur($xml_site->lire_valeur(_SITE_REDACTEUR));
         $this->ins_hebergeur($xml_site->lire_valeur(_SITE_HEBERGEUR));
         $this->ins_cnil($xml_site->lire_valeur(_SITE_CNIL));
         $loi_cookie = $xml_site->lire_valeur(_SITE_LOI_COOKIE);
         if (strlen($loi_cookie) > 0) {
             if (strcmp($loi_cookie, _SITE_ATTR_LOI_COOKIE_MOYEN) && strcmp($loi_cookie, _SITE_ATTR_LOI_COOKIE_FORT)) {
                 $this->loi_cookie = _SITE_ATTR_LOI_COOKIE_FAIBLE;
             } else {
                 $this->loi_cookie = $loi_cookie;
             }
         }
         $this->ins_pied_de_page($xml_site->lire_valeur(_SITE_PIED_DE_PAGE));
         // Elements du fichier site.xml
         $this->set_style_titre_1($xml_site->lire_valeur(_SITE_STYLE_TITRE_1));
         $this->set_style_titre_2($xml_site->lire_valeur(_SITE_STYLE_TITRE_2));
         $this->set_style_titre_3($xml_site->lire_valeur(_SITE_STYLE_TITRE_3));
         $this->set_style_paragraphe($xml_site->lire_valeur(_SITE_STYLE_TEXTE));
         $this->set_couleur_exterieur($xml_site->lire_valeur(_SITE_COULEUR_EXTERIEUR));
         $this->set_motif_exterieur($xml_site->lire_valeur(_SITE_MOTIF_EXTERIEUR));
         $this->set_papierpeint_exterieur($xml_site->lire_valeur(_SITE_PAPIERPEINT_EXTERIEUR));
         $this->set_couleur_interieur($xml_site->lire_valeur(_SITE_COULEUR_INTERIEUR));
         $this->set_motif_interieur($xml_site->lire_valeur(_SITE_MOTIF_INTERIEUR));
         $this->set_largeur($xml_site->lire_valeur(_SITE_LARGEUR));
         $this->set_largeur_max($xml_site->lire_valeur(_SITE_LARGEUR_MAX));
         $this->set_largeur_responsive($xml_site->lire_valeur(_SITE_LARGEUR_RESPONSIVE));
         $this->set_largeur_min($xml_site->lire_valeur(_SITE_LARGEUR_MIN));
     }
     return $ret;
 }