Browse Source

Amélioration de l'upgrade()

pull/19/head
Chancellier Pierre-Jean 1 year ago
parent
commit
5ff18c3b3a
  1. 4
      formulaires/configurer_tarteaucitron_services.php
  2. 21
      inc/tarteaucitron.php
  3. 2
      services/facebookpixel.html
  4. 2
      services/gtag.html
  5. 30
      tarteaucitron_administrations.php

4
formulaires/configurer_tarteaucitron_services.php

@ -36,7 +36,7 @@ if (!defined('_ECRIRE_INC_VERSION')) return;
$fieldset['saisies'][] = array(
'saisie' => 'input',
'options' => array(
'nom' => 'facebookpixelID',
'nom' => 'facebookpixelkey',
'label' => 'Facebook Pixel ID',
'explication' => 'Enter your FacebookPixel ID',
'placeholder' => 'YOUR_ID',
@ -48,7 +48,7 @@ if (!defined('_ECRIRE_INC_VERSION')) return;
$fieldset['saisies'][] = array(
'saisie' => 'input',
'options' => array(
'nom' => 'gtagUA',
'nom' => 'gtagkey',
'label' => 'Google global site tag (gtag.js)',
'explication' => 'Replace GA_MEASUREMENT_ID with the ID of the Google Analytics property to which you want to send data',
'placeholder' => 'GA_MEASUREMENT_ID',

21
inc/tarteaucitron.php

@ -37,15 +37,18 @@ function tarteaucitron_liste_services_actifs($objet, $id_objet, $page, $recherch
$ajouter_services = '';
foreach ($services_actifs as $service => $value) {
$ajouter_services .= recuperer_fond('services/'.$service,
array(
'objet' => $objet,
'id_objet' => $id_objet,
'page' => $page,
'recherche' => $recherche,
'resultat_page' => $resultat_page
)
);
if (strpos($service, "key",strlen($service)-3) === false){
$ajouter_services .= recuperer_fond('services/'.$service,
array(
'objet' => $objet,
'id_objet' => $id_objet,
'page' => $page,
'recherche' => $recherche,
'resultat_page' => $resultat_page
)
);
}
}
return $ajouter_services;

2
services/facebookpixel.html

@ -1,3 +1,3 @@
tarteaucitron.user.facebookpixelId = '[(#CONFIG{tarteaucitron/services/facebookpixelID})]';
tarteaucitron.user.facebookpixelId = '[(#CONFIG{tarteaucitron/services/facebookpixelkey})]';
tarteaucitron.user.facebookpixelMore = function () { /* add here your optionnal facebook pixel function */ };
(tarteaucitron.job = tarteaucitron.job || []).push('facebookpixel');

2
services/gtag.html

@ -1,3 +1,3 @@
tarteaucitron.user.gtagUa = '[(#CONFIG{tarteaucitron/services/gtagUA})]';
tarteaucitron.user.gtagUa = '[(#CONFIG{tarteaucitron/services/gtagkey})]';
tarteaucitron.user.gtagMore = function () { /* add here your optionnal gtag() */ };
(tarteaucitron.job = tarteaucitron.job || []).push('gtag');

30
tarteaucitron_administrations.php

@ -26,14 +26,17 @@ if (!defined('_ECRIRE_INC_VERSION')) {
function tarteaucitron_upgrade($nom_meta_base_version, $version_cible) {
$maj = array();
$maj['create'][] = array('ecrire_config', 'tarteaucitron',array(
'boutons' => 'twice',
'highprivacy' => array('true'),
'acceptallcta' => array('true'),
'showIcon' => array('true'),
'mandatory' => array('true'),
'moreInfoLink' => array('true')
));
$maj['create'] = array(
array('ecrire_config', 'tarteaucitron',array(
'boutons' => 'twice',
'highprivacy' => array('true'),
'acceptallcta' => array('true'),
'showIcon' => array('true'),
'mandatory' => array('true'),
'moreInfoLink' => array('true')
)),
array('maj_tarteaucitron_cfg')
);
$maj['1.1.0'][] = array('maj_tarteaucitron_cfg');
@ -50,7 +53,6 @@ function tarteaucitron_upgrade($nom_meta_base_version, $version_cible) {
* @return void
**/
function tarteaucitron_vider_tables($nom_meta_base_version) {
effacer_meta('tarteaucitron');
effacer_meta($nom_meta_base_version);
}
@ -70,7 +72,7 @@ function maj_tarteaucitron_cfg() {
switch ($service) {
case "gtag" :
if (!empty($value)) {
$cfg['services']['gtagUA'] = $value;
$cfg['services']['gtagkey'] = $value;
$cfg['services']['gtag'] = array("gtag");
}
break;
@ -82,7 +84,7 @@ function maj_tarteaucitron_cfg() {
break;
case "fb_pixel" :
if (!empty($value)) {
$cfg['services']['facebookpixelID'] = $value;
$cfg['services']['facebookpixelkey'] = $value;
$cfg['services']['facebookpixel'] = array("facebookpixel");
}
break;
@ -110,8 +112,8 @@ function maj_tarteaucitron_cfg() {
'youtube'
);
unset($cfg['gmap']);
unset($cfg['fb']);
unset($cfg['fb_pixel']);
ecrire_config('tarteaucitron',$cfg);
effacer_meta("tarteaucitron/gmap");
effacer_meta("tarteaucitron/fb");
effacer_meta("tarteaucitron/fb_pixel");
}
Loading…
Cancel
Save