Browse Source

quelques corrections

pull/19/head
Chancellier Pierre-Jean 9 months ago
parent
commit
12b799ac5e
  1. 14
      action/tarteaucitron_desinstaller_service.php
  2. 4
      inc/tarteaucitron.php
  3. 1
      modeles/tac_instagram.html
  4. 33
      tarteaucitron_pipelines.php

14
action/tarteaucitron_desinstaller_service.php

@ -57,11 +57,17 @@ function action_tarteaucitron_desinstaller_service_dist(){
}
include_spip('inc/config');
$services_installes = lire_config("tarteaucitron/services_installes/");
$cfg = lire_config("tarteaucitron");
if ($services_installes[$service]) {
unset($services_installes[$service]);
if ($cfg['services_installes'][$service]) {
unset($cfg['services_installes'][$service]);
}
ecrire_config("tarteaucitron/services_installes/", $services_installes);
foreach($cfg['services'] as $service_option => $value) {
if (preg_match("#^" . $service . "_?#",$service_option)) {
unset($cfg['services'][$service_option]);
}
}
ecrire_config("tarteaucitron", $cfg);
}

4
inc/tarteaucitron.php

@ -156,7 +156,7 @@ function tarteaucitron_scrap_service($service) {
$nom_param = str_replace(" ","_",$param->textContent);
$newelement = $doc->createTextNode("'#CONFIG{tarteaucitron/services/" . $service . "_" . $nom_param . "}'");
$span->replaceChild($newelement,$param);
$ret['params'][] = $nom_param;
array_unshift($ret['params'],$nom_param);
$j--;
}
@ -172,7 +172,7 @@ function tarteaucitron_scrap_service($service) {
}
// TODO : récupérer le HTML pour le modèle
$ret['html'] = "<p>Placez votre code HTML</p>";
$ret['html'] = "<p>Placez le code HTML</p>";
return $ret;

1
modeles/tac_instagram.html

@ -1 +0,0 @@
Placez le code HTML

33
tarteaucitron_pipelines.php

@ -79,19 +79,17 @@ function tarteaucitron_porte_plume_barre_pre_charger($barres){
$services_actifs = array_filter(lire_config('tarteaucitron/services', array()));
foreach ($services_actifs as $service => $value) {
if ($modele=find_in_path('modeles/tac_' . $service . '.html')) {
if (file_exists($modele)){
$file = fopen($modele,"r");
$text = fgets($file);
if ($text!="Placez le code HTML"){
$menu_items[] = array(
"id" => $service,
"name" => $service,
"className" => 'tac_' . $service,
"openWith" => "<tac_" . $service . "|id=",
'closeWith' => '[![' . _T('tarteaucitron:id_contenu') . ']!]>',
"display" => true
);
}
$file = fopen($modele,"r");
$text = fgets($file);
if (($text!="<p>Placez le code HTML</p>") && (find_in_path('icones_barre/' . $service . '.png'))) {
$menu_items[] = array(
"id" => $service,
"name" => $service,
"className" => 'tac_' . $service,
"openWith" => "<tac_" . $service . "|id=",
'closeWith' => '[![' . _T('tarteaucitron:id_contenu') . ']!]>',
"display" => true
);
}
}
}
@ -117,8 +115,13 @@ function tarteaucitron_porte_plume_lien_classe_vers_icone($flux){
$icons = array('tac_drop' => 'tac.png');
$services_actifs = array_filter(lire_config('tarteaucitron/services', array()));
foreach ($services_actifs as $service => $value) {
if (find_in_path('modeles/tac_' . $service . '.html')) {
$icons['tac_' . $service] = $service . '.png';
if ($modele=find_in_path('modeles/tac_' . $service . '.html')) {
$file = fopen($modele,"r");
$text = fgets($file);
if (($text!="<p>Placez le code HTML</p>") && (find_in_path('icones_barre/' . $service . '.png'))) {
$icons['tac_' . $service] = $service . '.png';
}
}
}

Loading…
Cancel
Save