''],'genererStyles.php'); // ----------------------------------------------------- // Polices // ----------------------------------------------------- $styleCSS .="@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@500&display=swap'); \n"; $styleCSS .="@import url('https://fonts.googleapis.com/css2?family=BhuTuka+Expanded+One&family=Dancing+Script&family=Hubballi&family=Kalam:wght@300&family=Monoton&family=Nothing+You+Could+Do&family=Pacifico&family=Permanent+Marker&family=Righteous&display=swap'); \n"; $styleCSS .="@import url('https://fonts.googleapis.com/css2?family=Aclonica&family=Amatic+SC&family=Assistant:wght@200&family=Audiowide&family=Bungee+Inline&family=Cabin+Sketch&family=Cairo:wght@200&family=Caveat&family=Coda&family=Cormorant+Garamond:wght@300&family=Grand+Hotel&family=Handlee&family=Henny+Penny&family=Indie+Flower&family=Italianno&family=Itim&family=Lemon&family=Mali:wght@200&family=Markazi+Text&family=Merienda&family=Noto+Serif+Display:wght@100&family=Patrick+Hand&family=Petit+Formal+Script&family=Philosopher&family=Playball&family=Playfair+Display&family=Rye&family=Sansita+Swashed:wght@300&family=Satisfy&family=Shadows+Into+Light&family=Smooch+Sans:wght@100&family=Tangerine&display=swap'); \n"; $moteurSCSS=0; if($moteurSCSS==1) { $styleCSS .="@import \"compass/css3\"; \n"; $styleCSS .="@import \"compass/layout\"; \n"; } // ----------------------------------------------------- // Objets géneriques // ----------------------------------------------------- // $styleCSS .= "* {@include box-sizing(border-box);} \n"; // ----------------------------------------------------- $styleCSS .= "* {box-sizing: border-box;} \n"; // ----------------------------------------------------- // Boucle sur les styles // ----------------------------------------------------- $resConn=''; $result=''; $reqSelect="SELECT nom FROM `" .$nomThemeCss. "` ;"; if (isset($debug[7]) && $debug[7] == '1') $debugMsg .= monDebug(2,['reqSelect' => $reqSelect],''); $resConn=$idPdo->query($reqSelect); while ($result=$resConn->fetch(PDO::FETCH_ASSOC)) { // ----------------------------------------------------- // Requete sur la table thème correspondante // ----------------------------------------------------- $theCssNomIci=$result['nom']; if (substr($theCssNomIci,0,3)!='---') { $reqSelect2="SELECT * from " .$nomThemeCss. " WHERE nom='" .$theCssNomIci. "';"; // // if (isset($debug[7]) && $debug[7] == '1') $debugMsg .= monDebug(2,['reqSelect2' => $reqSelect2],''); $result2=''; $result2= $idPdo->query($reqSelect2); $test=$result2->fetch(PDO::FETCH_ASSOC); if (isset($debug[7]) && $debug[1] == '7' ) monDebug(2,['nbr de champs ' .$cssNum => count($test) ],''); // ----------------------------------------------------- // si on n'est pas dans un style d'objet generique on rajoute un . au nom // ----------------------------------------------------- if ($theCssNomIci!='body' && $theCssNomIci!='a' && $theCssNomIci!='a:hover' && $theCssNomIci!='input' && substr($theCssNomIci,0,1)!='#' ) {$styleCSS .= ".";} // ----------------------------------------------------- // nom + Debut de balise // ----------------------------------------------------- $styleCSS .= $theCssNomIci. " {"; foreach ($test as $theCssAttr => $valeur) { if ($theCssAttr =='theLeft') {$theCssAttr="left";} // left réservé mysql if ($theCssAttr =='theFloat') {$theCssAttr="float";} // float réservé mysql if ($theCssAttr =='theRight') {$theCssAttr="right";} // right réservé mysql if ($theCssAttr =='theCursor') {$theCssAttr="cursor";} // cursor réservé mysql // ----------------------------------------------------- // Recup du thème // ----------------------------------------------------- if ($theCssAttr =='theme') {$theCssVolet=$valeur;} // ----------------------------------------------------- // Exclure les metas données // ----------------------------------------------------- if ($theCssAttr !='description' && $theCssAttr !='commentaires' && $theCssAttr !='theme' && $theCssAttr !='id' && $theCssAttr !='nom' && $valeur !='-' && $valeur !='' && $theCssAttr!='@keyframes' && $theCssAttr!='type') { $exception=0; // ----------------------------------------------------- // Cas des unités : px, em, %, ...fr ? Blindage // ----------------------------------------------------- if ($theCssAttr =='border-radius' ) { $myTest=strtoupper (substr ($valeur,-2,2)); $myTest2=strtoupper (substr ($valeur,-1,1)); if ($myTest!= "PX" && $myTest!= "EM" && $myTest2 != "%" && $myTest2 != "REM" && $myTest2 != "VW" && $myTest2 != "VH") { $styleCSS .= $theCssAttr. ': ' .$valeur. 'px; '; // $styleCSS .= "@include border-radius(" .$valeur. "px);"; } else { $styleCSS .= $theCssAttr. ': ' .$valeur. '; '; // $styleCSS .= "@include border-radius(" .$valeur. ");"; } $exception=1; } // ----------------------------------------------------- // Box shadow // ----------------------------------------------------- // if ($theCssAttr =='box-shadow' ) { // $styleCSS .= "@include box-shadow(" .$valeur. ");"; // $exception=1; // } // ----------------------------------------------------- // Cas des unités vides : px, em, %, ...fr ? // ----------------------------------------------------- if ($theCssAttr =='border-width' || $theCssAttr =='font-size') { $myTest=strtoupper (substr ($valeur,-2,2)); $myTest2=strtoupper (substr ($valeur,-1,1)); if ($myTest!= "PX" && $myTest!= "EM" && $myTest2 != "%" && $myTest2 != "REM" && $myTest2 != "VW" && $myTest2 != "VH") { // $styleCSS .= $theCssAttr. ': ' .$valeur. 'px; '; $styleCSS .= $theCssAttr. ': ' .$valeur. 'px; '; } else {$styleCSS .= $theCssAttr. ': ' .$valeur. '; ';} $exception=1; } // ----------------------------------------------------- // Cas animation // ----------------------------------------------------- // if ($theCssAttr =='transform' && $valeur!='' && $valeur!='-') { // $styleCSS .= "@include transform(" .$valeur. ");"; // $exception=1; // } // if ($theCssAttr =='transition' && $valeur!='' && $valeur!='-') { // $styleCSS .= "@include transition(" .$valeur. ");"; // $exception=1; // } // if ($theCssAttr =='animation' && $valeur!='' && $valeur!='-') { // $styleCSS .= "@include animation(" .$valeur. ");"; // $exception=1; // } // ----------------------------------------------------- // Cas du background URL : ('chemin') // ----------------------------------------------------- if ($theCssAttr =='background-image:url' ) { $styleCSS .= $theCssAttr. '(\'' .$valeur. '\');'; $exception=1; } // ----------------------------------------------------- // Cas des couleurs génériques // ----------------------------------------------------- // Clients // Catalogue // Commandes // Publicité // Information // Global if ($theCssAttr =='color' || $theCssAttr =='background' || $theCssAttr =='border-color' || $theCssAttr =='fill' ) { if ($valeur=='Couleur du thème' || $valeur=='Couleur globale') { require("determinerFamilleCouleur.php"); $exception=1; // ----------------------------------------------------- // Cas de la fontColor // ----------------------------------------------------- if ($theCssAttr =='color' || $theCssAttr =='border-color' || $theCssAttr =='fill' ) { switch ($valeur) { case 'Couleur du thème': $valeur=$voletFontColorTheme; $styleCSS .= $theCssAttr. ': ' .$voletFontColorTheme. '; ';$exception=1; break; case 'Couleur globale': $valeur=$voletFontColorGlobal; $styleCSS .= $theCssAttr. ': ' .$voletFontColorGlobal. '; ';$exception=1; break; } } // ----------------------------------------------------- // Cas du backGround Color // ----------------------------------------------------- if ($theCssAttr =='background' ) { if (isset($debug[7]) && $debug[7] == '1') { $debugMsg .= monDebug(1, ['theCssAttr =' => $theCssAttr, '--> valeur' => $valeur], '');} switch ($valeur) { case 'Couleur du thème': $valeur=$voletBgColorTheme; $styleCSS .= $theCssAttr. ': ' .$voletBgColorTheme. '; ';$exception=1; break; case 'Couleur globale': $valeur=$voletBGColorGlobal; $styleCSS .= $theCssAttr. ': ' .$voletBGColorGlobal. '; ';$exception=1; break; } } } } // ----------------------------------------------------- // Cas des borders uniques // ----------------------------------------------------- if ($theCssAttr =='border-top' || $theCssAttr =='border-right' || $theCssAttr =='border-bottom' || $theCssAttr =='border-left' ) { require("determinerFamilleCouleur.php"); // 1 - chercher dans la valeur la chaine Couleur du thème ' $test=''; $test=strpos('Couleur du thème',$theCssAttr); // 2 - si trouver : remplacer if ($test!==false) {$theCssAttr=str_replace('Couleur du thème',$voletFontColorTheme,$theCssAttr);$exception=1;} // 1 - chercher dans la valeur la chaine Couleur globale' $test=''; $test=strpos('Couleur globale',$theCssAttr); // 2 - si trouver : remplacer if ($test!='') {$theCssAttr=str_replace('Couleur globale',$voletFontColorGlobal,$theCssAttr);$exception=1;} } // ----------------------------------------------------- // Cas normal : pas d'exception // ----------------------------------------------------- if ($exception==0) {$styleCSS .= $theCssAttr. ': ' .$valeur. '; '; } } // if theCssAttr pas meta donnée if (isset($debug[7]) && $debug[7] == '1') { $debugMsg .= monDebug(1, ['Css nom ici =' => $theCssNomIci, ' attribut=' => $theCssAttr, ' valeur =' => $valeur], '');} } //for // ----------------------------------------------------- // Fin de balise // ----------------------------------------------------- $styleCSS .= "} \n"; } $cssNum++; } // while listeStyle $nb=$cssNum; // ----------------------------------------------------- // Cas des key frame => en bas et hors {} // ----------------------------------------------------- $resConn=''; $cssNum=0; $result=''; $reqSelect="SELECT nom FROM `" .$nomThemeCss. "` ;"; if (isset($debug[7]) && $debug[7] == '1') $debugMsg .= monDebug(2,['reqSelect' => $reqSelect],'generer styles-key frame'); $resConn=$idPdo->query($reqSelect) ; while ($result=$resConn->fetch(PDO::FETCH_ASSOC)) { $theCssNomIci=$result['nom']; if (substr($theCssNomIci,0,3)!='---') { // ----------------------------------------------------- $reqSelect2="SELECT * from " .$nomThemeCss. " WHERE nom='" .$theCssNomIci. "';"; if (isset($debug[7]) && $debug[7] == '1') $debugMsg .= monDebug(1,['reqSelect2' => $reqSelect2],''); $result2=''; $result2 = $idPdo->query($reqSelect2); $test=$result2->fetch(PDO::FETCH_ASSOC); foreach ($test as $theCssNomIci => $valeur) { if ($theCssNomIci=='@keyframes' && $valeur !='' && $valeur !='-' && $valeur !=' ') { $styleCSS .= $theCssNomIci. ' ' .$valeur; $styleCSS .= "\n"; if (isset($debug[7]) && $debug[7] == '1') { $debugMsg .= monDebug(1, ['theCssNomIci' => $theCssNomIci, ' val' => $valeur], '');} $nb=$nb+1; } } } $cssNum++; } // while listeStyle // ----------------------------------------------------- // Ecriture du fichier scss ou css // ----------------------------------------------------- $retour=''; $moteurSCSS=0; if($moteurSCSS==1) {$retour=file_put_contents($includePathPublication. '/_makeCss/sass/globalStyle_' .$nomThemeCss. '.scss', $styleCSS);} else {$retour=file_put_contents($includePathPublication. '/_css/globalStyle_' .$nomThemeCss. '.css', $styleCSS);} echo ''; if (isset($debug[1]) && $debug[1] == '1') { $debugMsg .= monDebug(1, ['retour:' => $retour], '');} if ($retour !='') { // $resCSS=1; $admMsgClass='ok'; if (isset($debug[1]) && $debug[1] == '1') { $debugMsg .= monDebug(2, ['Traitement du fichier ' => $includePathPublication, '/_css/globalStyle_' => $nomThemeCss, ' OK ! ' => ''], '');} // -> Code retour : ' .$retour. '
'; $admMsg .= $nb. " styles générés avec succès !"; if (isset($debug[1]) && $debug[1] == '1') { $debugMsg .= monDebug(1, ['structure' => $_SESSION['numStruct']], '');} } else { $admMsg .= "Erreur lors de l'écriture du fichier css !"; $admMsgClass='ko'; } echo '
'; ?>