New feature : Ajouter des services
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin TarteAuCitron
|
||||
* Licence GPL3
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')){
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Désinstalle un service
|
||||
* appelé avec ?action=tac_desinstaller_service&service=service
|
||||
* autorisé pour les seuls webmestres
|
||||
*/
|
||||
function action_tac_desinstaller_service_dist(){
|
||||
include_spip('inc/tarteaucitron');
|
||||
include_spip('inc/autoriser');
|
||||
|
||||
if (!autoriser('webmestre')){
|
||||
die('Pas autorise');
|
||||
}
|
||||
|
||||
$service = _request('service');
|
||||
$list_services = tarteaucitron_liste_services();
|
||||
|
||||
if (!array_key_exists($service,$list_services)) {
|
||||
die('Service inexistant');
|
||||
}
|
||||
|
||||
if ($list_services[$service]['statut']=='desinstalle') {
|
||||
die('Service déjà désinstallé');
|
||||
}
|
||||
|
||||
$file = _DIR_PLUGIN_TARTEAUCITRON . "services/" . $service . ".html";
|
||||
if (file_exists($file)) {
|
||||
unlink($file);
|
||||
}
|
||||
|
||||
$file = _DIR_PLUGIN_TARTEAUCITRON . "modeles/tac_" . $service . ".html";
|
||||
if (file_exists($file)) {
|
||||
unlink($file);
|
||||
}
|
||||
|
||||
$file = _DIR_PLUGIN_TARTEAUCITRON . "icones_barre/" . $service . ".png";
|
||||
if (file_exists($file)) {
|
||||
unlink($file);
|
||||
}
|
||||
|
||||
include_spip('inc/config');
|
||||
$services_installes = lire_config("tarteaucitron/services_installes/");
|
||||
|
||||
$i = 0;
|
||||
foreach($services_installes as $service_installe) {
|
||||
if ($service==$service_installe){
|
||||
array_splice($services_installes,$i,1);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
ecrire_config("tarteaucitron/services_installes/", $services_installes);
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin TarteAuCitron
|
||||
* Licence GPL3
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')){
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Installe un service
|
||||
* appelé avec ?action=tac_installer_service&service=service
|
||||
* autorisé pour les seuls webmestres
|
||||
*/
|
||||
function action_tac_installer_service_dist(){
|
||||
include_spip('inc/tarteaucitron');
|
||||
include_spip('inc/autoriser');
|
||||
|
||||
if (!autoriser('webmestre')){
|
||||
die('Pas autorise');
|
||||
}
|
||||
|
||||
$service = _request('service');
|
||||
$list_services = tarteaucitron_liste_services();
|
||||
|
||||
if (!array_key_exists($service,$list_services)) {
|
||||
die('Service inexistant');
|
||||
}
|
||||
|
||||
if ($list_services[$service]['statut']=='installe') {
|
||||
die('Service déjà installé');
|
||||
}
|
||||
|
||||
file_put_contents(_DIR_PLUGIN_TARTEAUCITRON . "services/" . $service . ".html", "(tarteaucitron.job = tarteaucitron.job || []).push('" . $service . "');");
|
||||
// TODO : récupérer le modèle HTML de tarteaucitron (scrapping ?)
|
||||
file_put_contents(_DIR_PLUGIN_TARTEAUCITRON . 'modeles/tac_' . $service . '.html', "Placez le code HTML");
|
||||
|
||||
// TODO : créer un fichier icones_barre/monservice.png en 17px de côté avec le nom du service ?
|
||||
|
||||
include_spip('inc/config');
|
||||
$services_installes = lire_config("tarteaucitron/services_installes/");
|
||||
|
||||
if (!in_array($service,$services_installes,true)) {
|
||||
$services_installes[] = $service;
|
||||
}
|
||||
|
||||
ecrire_config("tarteaucitron/services_installes/", $services_installes);
|
||||
}
|
@ -0,0 +1,251 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin TarteAuCitron
|
||||
* Licence GPL3
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Conversion des iframe en modèles pour TarteAuCitron
|
||||
* appelé avec ?action=tac_nettoyer_iframes
|
||||
* autorisé pour les seuls webmestres
|
||||
*/
|
||||
function action_tac_nettoyer_iframes_dist(){
|
||||
include_spip('inc/autoriser');
|
||||
include_spip('inc/filtres');
|
||||
include_spip('action/editer_objet');
|
||||
if (!autoriser('webmestre')){
|
||||
die('Pas autorise');
|
||||
}
|
||||
echo '<h1>Conversion des <iframe></h1>';
|
||||
$simu = true;
|
||||
if (_request('modif')){
|
||||
$simu = false;
|
||||
}
|
||||
if ($simu){
|
||||
echo "<p><strong>mode SIMULATION</strong> (ajoutez &modif=1 dans l'url pour modifier les contenus)</p>";
|
||||
}
|
||||
|
||||
$tables = array(
|
||||
'spip_articles' => array('descriptif', 'chapo', 'texte', 'ps'),
|
||||
);
|
||||
|
||||
foreach ($tables as $table => $champs){
|
||||
$objet = objet_type($table);
|
||||
foreach ($champs as $champ){
|
||||
$primary = id_table_objet($table);
|
||||
$res = sql_select("$primary,$champ", $table, "$champ LIKE '%iframe%' OR $champ LIKE '%object%'");
|
||||
while ($row = sql_fetch($res)){
|
||||
$pre = "$primary=" . $row[$primary] . ":$champ:";
|
||||
|
||||
$texte = $row[$champ];
|
||||
$iframes = extraire_balises($texte, 'iframe');
|
||||
if (count($iframes)){
|
||||
foreach ($iframes as $iframe){
|
||||
$url = '';
|
||||
$src = extraire_attribut($iframe, 'src');
|
||||
if (strncmp($src, '//', 2)==0){
|
||||
$src = 'http:' . $src;
|
||||
}
|
||||
if (strpos($iframe, 'youtube')!==false){
|
||||
if (strpos($src, '/embed/')!==false){
|
||||
$url = str_replace('?', '&', $src);
|
||||
$url = str_replace('/embed/videoseries&', '/playlist?', $url);
|
||||
$url = str_replace('/embed/', '/watch?v=', $url);
|
||||
$url = str_replace('&feature=player_embedded', '', $url);
|
||||
preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $url, $match);
|
||||
$url = "<tac_youtube|id=" . $match[1] . ">";
|
||||
|
||||
echo "$pre Youtube " . entites_html($url) . "<br />";
|
||||
}
|
||||
if (!$url){
|
||||
var_dump($row);
|
||||
var_dump(entites_html($iframe));
|
||||
die('youtube inconnue');
|
||||
}
|
||||
} elseif (strpos($iframe, 'dailymotion')!==false) {
|
||||
if (strpos($src, '/embed/')!==false){
|
||||
$url = str_replace('/embed/', '/', $src);
|
||||
$url = explode('?', $url);
|
||||
$url = reset($url);
|
||||
$url = "<tac_dailymotion|id=" . strtok(basename($url), '_') . ">";
|
||||
echo "$pre DailyMotion" . entites_html($url) . "<br />";
|
||||
}
|
||||
if (!$url){
|
||||
var_dump($row);
|
||||
var_dump($iframe);
|
||||
die('dailymotion inconnue');
|
||||
}
|
||||
} elseif (strpos($iframe, 'player.vimeo')!==false) {
|
||||
if (strpos($src, '/video/')!==false){
|
||||
$url = str_replace('/video/', '/', $src);
|
||||
$url = str_replace('player.vimeo', 'vimeo', $url);
|
||||
$url = explode('?', $url);
|
||||
$url = reset($url);
|
||||
preg_match('%https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)%i', $url, $match);
|
||||
$url = "<tac_vimeo|id=" . $match[3] . ">";
|
||||
echo "$pre Vimeo " . entites_html($url) . "<br />";
|
||||
}
|
||||
if (!$url){
|
||||
var_dump($row);
|
||||
var_dump($iframe);
|
||||
die('vimeo inconnue');
|
||||
}
|
||||
} /*elseif (strpos($iframe, 'soundcloud') !== false) {
|
||||
// un peu complique :
|
||||
// il faut faire une requete oembed sur l'url api, avec iframe=false
|
||||
// pour recuperer du html avec un lien vers la page soundcloud
|
||||
parse_str(end(explode('?', $src)), $args);
|
||||
$api_url = $args['url'];
|
||||
include_spip('inc/oembed');
|
||||
include_spip('inc/distant');
|
||||
$provider = oembed_verifier_provider($api_url);
|
||||
$data_url = parametre_url(url_absolue($provider['endpoint'], url_de_base()), 'url', $api_url, '&');
|
||||
$data_url = parametre_url($data_url, 'format', 'json', '&');
|
||||
$data_url = parametre_url($data_url, 'iframe', 'false', '&');
|
||||
$json = recuperer_page($data_url);
|
||||
$json = json_decode($json, true);
|
||||
$link = extraire_balise($json['html'], 'a');
|
||||
if ($url = extraire_attribut($link, 'href')) {
|
||||
echo "$pre SoundCloud $url<br />";
|
||||
}
|
||||
if (!$url) {
|
||||
var_dump($row);
|
||||
var_dump($iframe);
|
||||
die('soundcloud inconnue');
|
||||
}
|
||||
} */ elseif (strpos($iframe, 'www.google.com/calendar') !== false) {
|
||||
if (strpos($src, '/embed')!==false){
|
||||
preg_match('#(src=)(\w+)$#', $src, $match);
|
||||
$url = "<tac_gagenda|id=" . $match[2] . ">";
|
||||
|
||||
echo "$pre Google Agenda " . entites_html($url) . "<br />";
|
||||
}
|
||||
} elseif (strpos($iframe, 'www.canal-u.tv/video') !== false) {
|
||||
if (strpos($src, '/embed')!==false){
|
||||
preg_match('#(/embed.1/)(.+)(\?)#', $src, $match);
|
||||
$url = "<tac_canalu|id=" . $match[2] . ">";
|
||||
$divs = extraire_balises($texte, 'div');
|
||||
foreach ($divs as $div) {
|
||||
if (strpos($div, $match[2])!==false) {
|
||||
$iframe = $div;
|
||||
}
|
||||
}
|
||||
|
||||
echo "$pre Canal-U.tv " . entites_html($url) . "<br />";
|
||||
}
|
||||
} elseif (strpos($iframe, 'webtv.normandie-univ.fr') !== false) {
|
||||
if (strpos($src, '/permalink/')!==false){
|
||||
preg_match('#(/permalink/)(\w+)(/iframe)#', $src, $match);
|
||||
$url = "<tac_webtvnu|id=" . $match[2] . ">";
|
||||
echo "$pre WebTV Normandie Université " . entites_html($url) . "<br />";
|
||||
}
|
||||
} else {
|
||||
echo "$pre iframe inconnue : " . entites_html($iframe) . '<br />';
|
||||
}
|
||||
if ($url){
|
||||
$texte = str_replace($iframe, "\n\n" . $url . "\n\n", $texte);
|
||||
if (preg_match(',<center>\s*' . preg_quote($url, ',') . '.*</center>,Uims', $texte, $m)){
|
||||
$texte = str_replace($m[0], "\n\n" . $url . "\n\n", $texte);
|
||||
}
|
||||
$texte = preg_replace(',\s+' . preg_quote($url, ',') . '\s+,ims', "\n\n" . $url . "\n\n", $texte);
|
||||
}
|
||||
}
|
||||
if ($texte!==$row[$champ]){
|
||||
echo "$pre Corrige $champ <br />";
|
||||
if (!$simu){
|
||||
echo "$pre Corrige $champ <br />";
|
||||
objet_modifier($objet, $row[$primary], array($champ => $texte));
|
||||
} else {
|
||||
echo "SIMU : $pre Corrige $champ <br />";
|
||||
}
|
||||
}
|
||||
}
|
||||
$objects = extraire_balises($texte, 'object');
|
||||
if (count($objects)){
|
||||
foreach ($objects as $object){
|
||||
$url = '';
|
||||
$src = extraire_attribut($object, 'data');
|
||||
if (strncmp($src, '//', 2)==0){
|
||||
$src = 'http:' . $src;
|
||||
}
|
||||
if (strpos($src, 'youtube')!==false){
|
||||
if (strpos($src, '/v/')!==false){
|
||||
$url = str_replace('?', '&', $src);
|
||||
$url = str_replace('/v/', '/watch?v=', $url);
|
||||
} elseif (strpos($src, '/embed/')!==false) {
|
||||
$url = str_replace('?', '&', $src);
|
||||
$url = str_replace('/embed/', '/watch?v=', $url);
|
||||
}
|
||||
if (!$url){
|
||||
var_dump($row);
|
||||
var_dump(entites_html($object));
|
||||
die('youtube inconnue');
|
||||
} else {
|
||||
preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $url, $match);
|
||||
$url = "<tac_youtube|id=" . $match[1] . ">";
|
||||
echo "$pre Youtube " . entites_html($url) . "<br />";
|
||||
}
|
||||
} elseif (strpos($src, 'dailymotion')!==false) {
|
||||
if (strpos($src, '/swf/video/')!==false){
|
||||
$url = str_replace('/swf/video/', '/video/', $src);
|
||||
$url = explode('?', $url);
|
||||
$url = reset($url);
|
||||
} elseif (strpos($src, '/swf/')!==false) {
|
||||
$url = str_replace('/swf/', '/video/', $src);
|
||||
$url = explode('?', $url);
|
||||
$url = reset($url);
|
||||
}
|
||||
if (!$url){
|
||||
var_dump($row);
|
||||
var_dump($object);
|
||||
die('dailymotion inconnue');
|
||||
} else {
|
||||
$url = "<tac_dailymotion|id=" . strtok(basename($url), '_') . ">";
|
||||
echo "$pre DailyMotion" . entites_html($url) . "<br />";
|
||||
}
|
||||
} elseif (strpos($src, 'vimeo.com')!==false) {
|
||||
if (strpos($src, 'moogaloop')!==false
|
||||
and $id = parametre_url($src, 'clip_id')){
|
||||
$url = "https://vimeo.com/$id";
|
||||
} elseif (strpos($src, '/video/')!==false) {
|
||||
$url = $src;
|
||||
}
|
||||
if (!$url){
|
||||
var_dump($row);
|
||||
var_dump(entites_html($object));
|
||||
die('vimeo inconnue');
|
||||
} else {
|
||||
preg_match('%https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)%i', $url, $match);
|
||||
$url = "<tac_vimeo|id=" . $match[3] . ">";
|
||||
echo "$pre Vimeo " . entites_html($url) . "<br />";
|
||||
}
|
||||
} else {
|
||||
echo "$pre object inconnue : " . entites_html($object) . '<br />';
|
||||
}
|
||||
if ($url){
|
||||
$texte = str_replace($object, "\n\n" . $url . "\n\n", $texte);
|
||||
if (preg_match(',<center>\s*' . preg_quote($url, ',') . '.*</center>,Uims', $texte, $m)){
|
||||
$texte = str_replace($m[0], "\n\n" . $url . "\n\n", $texte);
|
||||
}
|
||||
$texte = preg_replace(',\s+' . preg_quote($url, ',') . '\s+,ims', "\n\n" . $url . "\n\n", $texte);
|
||||
}
|
||||
}
|
||||
if ($texte!==$row[$champ]){
|
||||
if (!$simu){
|
||||
echo "$pre Corrige $champ <br />";
|
||||
objet_modifier($objet, $row[$primary], array($champ => $texte));
|
||||
} else {
|
||||
echo "SIMU : $pre Corrige $champ <br />";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin TarteAuCitron
|
||||
* Licence GPL3
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retourne la lise des services avec leur type et leur statut (installe/desinstalle)
|
||||
* au format json
|
||||
* appelé avec ?exec=tac_liste_services
|
||||
*/
|
||||
function exec_tac_liste_services_dist(){
|
||||
include_spip('inc/tarteaucitron');
|
||||
include_spip('inc/autoriser');
|
||||
|
||||
if (!autoriser('webmestre')){
|
||||
die('Pas autorise');
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
$list_services = tarteaucitron_liste_services();
|
||||
|
||||
echo json_encode($list_services);
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
<div id="formulaire_#FORM"" class="formulaire_spip formulaire_configurer formulaire_#FORM">
|
||||
<div>
|
||||
<ol class="explication">
|
||||
<li>Recherchez et installez votre service</li>
|
||||
<li>Activez votre service</li>
|
||||
<li>Si besoin, éditez le fichier <code>modeles/tac_monservice.html</code> pour y placer le code fourni par <a href="https://tarteaucitron.io/fr/install/">TarteAuCitron (Etape3)</a> et ajoutez une icône <code>icones_barre/monservice.png</code> pour permettre aux rédacteurs d'insérer du contenu facilement via la barre d'outils du porte-plume</li>
|
||||
</ol>
|
||||
<div class="editer-groupe">
|
||||
<div class="editer editer_searchService obligatoire saisie_input editer_even">
|
||||
<label class="label" for="champ_searchService"><:tarteaucitron:cfg_titre_recherche_services:></label>
|
||||
<input type="text" name="searchService" class="text" id="champ_searchService" value="" required="required" placeholder="<:tarteaucitron:cfg_titre_placeholder_recherche_services:>" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="image_loading"></div>
|
||||
<fieldset>
|
||||
<legend><:tarteaucitron:cfg_titre_result_recherche_services:></legend>
|
||||
<div id="tac_results"></div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var tac_url = '?exec=tac_liste_services',
|
||||
oldValue = ''
|
||||
services = {};
|
||||
|
||||
$('#formulaire_#FORM').animateLoading();
|
||||
|
||||
$.ajax({
|
||||
url: tac_url,
|
||||
dataType: 'json',
|
||||
success: (data) => {
|
||||
services = data
|
||||
},
|
||||
complete: () => {
|
||||
$('#formulaire_#FORM').endLoading(true)
|
||||
}
|
||||
});
|
||||
|
||||
// Appliquer un délai à l'exécution d'une fonction
|
||||
function delay(fn, ms) {
|
||||
let timer = 0
|
||||
return function(...args) {
|
||||
clearTimeout(timer)
|
||||
timer = setTimeout(fn.bind(this, ...args), ms || 0)
|
||||
}
|
||||
}
|
||||
|
||||
// Fonction de recherche
|
||||
function rechService(search) {
|
||||
if (!search) {
|
||||
$('#tac_results').html('')
|
||||
return false
|
||||
}
|
||||
|
||||
var html = '<ul class="liste-items">'
|
||||
jQuery.each(services, function(service, prop) {
|
||||
var status = ''
|
||||
var properties = Object.entries(prop)
|
||||
jQuery.each(properties, function(i,property){
|
||||
if (property[0]=='statut') {
|
||||
status = property[1]
|
||||
}
|
||||
})
|
||||
if (service.toLowerCase().indexOf(search) >= 0) {
|
||||
var btn_texte = (status=='desinstalle') ? '<:tarteaucitron:cfg_installer:>' : '<:tarteaucitron:cfg_desinstaller:>'
|
||||
var action = (status=='desinstalle') ? 'tac_installer_service' : 'tac_desinstaller_service'
|
||||
html += '<li class="item">' + service + '<a href="?action=' + action + '&service=' + service + '&redirect=?exec=configurer_services" class="btn">' + btn_texte + '</a></li>'
|
||||
}
|
||||
});
|
||||
html += '</ul>'
|
||||
|
||||
$('#tac_results').html(html)
|
||||
}
|
||||
|
||||
// On actualise les résultats de recherche à chaque modification
|
||||
$('#champ_searchService').keyup(delay((e) => {
|
||||
if (e.target.value == oldValue) {
|
||||
e.preventDefault()
|
||||
return false
|
||||
}
|
||||
oldValue = e.target.value
|
||||
rechService(e.target.value)
|
||||
}, 250));
|
||||
</script>
|
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
if (!defined('_ECRIRE_INC_VERSION')) return;
|
||||
|
||||
|
||||
/**
|
||||
* Un simple formulaire de config,
|
||||
* on a juste à déclarer les saisies
|
||||
**/
|
||||
function formulaires_configurer_tarteaucitron_ouverture_saisies_dist(){
|
||||
// $saisies est un tableau décrivant les saisies à afficher dans le formulaire de configuration
|
||||
$saisies = array(
|
||||
array(
|
||||
'saisie' => 'selection',
|
||||
'options' => array(
|
||||
'nom' => 'ouverture',
|
||||
'option_intro' => '<:tarteaucitron:cfg_aucun:>',
|
||||
'label' => '<:tarteaucitron:cfg_ouverture_type:>',
|
||||
'defaut' => '',
|
||||
'data' => array(
|
||||
'image' => '<:tarteaucitron:cfg_image:>',
|
||||
'alertSmall' => '<:tarteaucitron:cfg_small_alert:>'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'saisie' => 'selection',
|
||||
'options' => array(
|
||||
'nom' => 'iconPosition',
|
||||
'option_intro' => '<:tarteaucitron:cfg_choose_option:>',
|
||||
'label' => '<:tarteaucitron:cfg_iconposition:>',
|
||||
'defaut' => 'BottomRight',
|
||||
'data' => array(
|
||||
'BottomRight' => '<:tarteaucitron:cfg_position_bd:>',
|
||||
'BottomLeft' => '<:tarteaucitron:cfg_position_bg:>',
|
||||
'TopRight' => '<:tarteaucitron:cfg_position_hd:>',
|
||||
'TopLeft' => '<:tarteaucitron:cfg_position_hg:>'
|
||||
),
|
||||
'afficher_si' => '@ouverture@ == "image"'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'saisie' => 'selecteur_document',
|
||||
'options' => array(
|
||||
'nom' => 'icon',
|
||||
'label' => '<:tarteaucitron:cfg_icon:>',
|
||||
'media' => 'image',
|
||||
'afficher_si' => '@ouverture@ == "image"'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'saisie' => 'checkbox',
|
||||
'options' => array(
|
||||
'nom' => 'cookieslist',
|
||||
'label' => '<:tarteaucitron:cfg_cookieslist:>',
|
||||
'explication' => '<:tarteaucitron:cfg_cookieslist_explication:>',
|
||||
'data' => array(
|
||||
'true' => '<:item_oui:>'
|
||||
),
|
||||
'afficher_si' => '@ouverture@ == "alertSmall"'
|
||||
)
|
||||
)
|
||||
);
|
||||
return $saisies;
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
if (!defined('_ECRIRE_INC_VERSION')) return;
|
||||
|
||||
|
||||
/**
|
||||
* Un simple formulaire de config,
|
||||
* on a juste à déclarer les saisies
|
||||
**/
|
||||
function formulaires_configurer_tarteaucitron_panneau_saisies_dist(){
|
||||
// $saisies est un tableau décrivant les saisies à afficher dans le formulaire de configuration
|
||||
$saisies = array(
|
||||
array(
|
||||
'saisie' => 'textarea',
|
||||
'options' => array(
|
||||
'nom' => 'lang_disclaimer',
|
||||
'label' => '<:tarteaucitron:cfg_text_disclaimer:>',
|
||||
'explication' => '<:tarteaucitron:cfg_text_disclaimer_explication:>',
|
||||
'rows' => 3
|
||||
)
|
||||
),
|
||||
array(
|
||||
'saisie' => 'checkbox',
|
||||
'options' => array(
|
||||
'nom' => 'mandatory',
|
||||
'label' => '<:tarteaucitron:cfg_mandatory:>',
|
||||
'explication' => '<:tarteaucitron:cfg_mandatory_explication:>',
|
||||
'data' => array(
|
||||
'true' => '<:item_oui:>'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'saisie' => 'checkbox',
|
||||
'options' => array(
|
||||
'nom' => 'moreInfoLink',
|
||||
'label' => '<:tarteaucitron:cfg_moreinfolink:>',
|
||||
'data' => array(
|
||||
'true' => '<:item_oui:>'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'saisie' => 'input',
|
||||
'options' => array(
|
||||
'nom' => 'readmoreLink',
|
||||
'label' => '<:tarteaucitron:cfg_readmorelink:>',
|
||||
'explication' => '<:tarteaucitron:cfg_readmorelink_explication:>',
|
||||
'afficher_si' => '@moreInfoLink@ == "true"'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'saisie' => 'checkbox',
|
||||
'options' => array(
|
||||
'nom' => 'removeCredit',
|
||||
'label' => '<:tarteaucitron:cfg_remove_credit:>',
|
||||
'explication' => '<:tarteaucitron:cfg_remove_credit_explication:>',
|
||||
'attention' => '<:tarteaucitron:cfg_remove_credit_attention:>',
|
||||
'data' => array(
|
||||
'true' => '<:item_oui:>'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
return $saisies;
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
<div class="formulaire_spip formulaire_configurer formulaire_#FORM">
|
||||
|
||||
[<p class="reponse_formulaire reponse_formulaire_ok">(#ENV*{message_ok})</p>]
|
||||
[<p class="reponse_formulaire reponse_formulaire_erreur">(#ENV*{message_erreur})</p>]
|
||||
|
||||
<form method="post" action="#ENV{action}">
|
||||
<div>
|
||||
#ACTION_FORMULAIRE{#ENV{action}}
|
||||
|
||||
<fieldset>
|
||||
<legend>Services Google</legend>
|
||||
[(#REM) Gtag : voir à ce propos
|
||||
https://developers.google.com/analytics/devguides/collection/gtagjs/
|
||||
et https://juliencoquet.com/en/2017/09/11/switch-google-analytics-global-site-tag/][
|
||||
(#SAISIE{input, gtag, 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})]
|
||||
|
||||
[(#SAISIE{input, gmap, label=Google Map API Key, explication=Enter your Google Map API Key, placeholder=API KEY})]
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Services Facebook</legend>
|
||||
[(#SAISIE{checkbox, fb, label=Boutons de Like et Partage Facebook, data=[(#ARRAY{fb,fb})]})]
|
||||
|
||||
[(#SAISIE{input, fb_pixel, label=Facebook Pixel, explication=Enter your FacebookPixel ID, placeholder=YOUR_ID})]
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Twitter</legend>
|
||||
[(#SAISIE{checkbox, twitter, label=Twitter, datas=[(#ARRAY{twitter,Twitter})]})]
|
||||
[(#SAISIE{checkbox, twitterembed, label=Twitter (cards), datas=[(#ARRAY{twitterembed,Twitter (cards)})]})]
|
||||
</fieldset>
|
||||
|
||||
<input type="hidden" name="_meta_casier" value="tarteaucitron/services" />
|
||||
<p class="boutons"><span class="image_loading"> </span><input type="submit" class="submit" value="<:bouton_enregistrer:>" /></p>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
if (!defined('_ECRIRE_INC_VERSION')) return;
|
||||
|
||||
function formulaires_configurer_tarteaucitron_services_saisies_dist(){
|
||||
include_spip('inc/tarteaucitron');
|
||||
$saisies = [];
|
||||
$types_installes = tarteaucitron_liste_types_installes();
|
||||
|
||||
foreach($types_installes as $type => $liste_services) {
|
||||
$fieldset = array(
|
||||
'saisie' => 'fieldset',
|
||||
'options' => array(
|
||||
'nom' => $type,
|
||||
'label' => $type,
|
||||
'pliable' => 'oui',
|
||||
'plie' => 'oui'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
|
||||
foreach($liste_services as $service) {
|
||||
$champ = array(
|
||||
'saisie' => 'checkbox',
|
||||
'options' => array(
|
||||
'nom' => $service,
|
||||
'datas' => array(
|
||||
$service => $service
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$fieldset['saisies'][] = $champ;
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'ads':
|
||||
$fieldset['saisies'][] = array(
|
||||
'saisie' => 'input',
|
||||
'options' => array(
|
||||
'nom' => 'facebookpixelID',
|
||||
'label' => 'Facebook Pixel ID',
|
||||
'explication' => 'Enter your FacebookPixel ID',
|
||||
'placeholder' => 'YOUR_ID',
|
||||
'afficher_si' => '@facebookpixel@ == "facebookpixel"'
|
||||
)
|
||||
);
|
||||
break;
|
||||
case 'analytic':
|
||||
$fieldset['saisies'][] = array(
|
||||
'saisie' => 'input',
|
||||
'options' => array(
|
||||
'nom' => 'gtagUA',
|
||||
'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',
|
||||
'afficher_si' => '@gtag@ == "gtag"'
|
||||
)
|
||||
);
|
||||
break;
|
||||
case 'api':
|
||||
$fieldset['saisies'][] = array(
|
||||
'saisie' => 'input',
|
||||
'options' => array(
|
||||
'nom' => 'gmapkey',
|
||||
'label' => 'Google Map API Key',
|
||||
'explication' => 'Enter your Google Map API Key',
|
||||
'placeholder' => 'API KEY',
|
||||
'afficher_si' => '@googlemaps@ == "googlemaps"'
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
$saisies[] = $fieldset;
|
||||
}
|
||||
|
||||
$saisies[] = array(
|
||||
'saisie' => 'hidden',
|
||||
'options' => array(
|
||||
'nom' => '_meta_casier',
|
||||
'defaut' => 'tarteaucitron/services'
|
||||
)
|
||||
);
|
||||
|
||||
return $saisies;
|
||||
}
|
After Width: | Height: | Size: 661 B |
After Width: | Height: | Size: 376 B |
After Width: | Height: | Size: 615 B |
After Width: | Height: | Size: 577 B |
After Width: | Height: | Size: 802 B |
After Width: | Height: | Size: 647 B |
After Width: | Height: | Size: 446 B |
After Width: | Height: | Size: 454 B |
@ -0,0 +1,3 @@
|
||||
[<div class="canalu_player"
|
||||
videoTitle="(#ENV{id})">
|
||||
</div><br>]
|
@ -0,0 +1,8 @@
|
||||
[<div class="dailymotion_player"
|
||||
videoID="(#ENV{id})"
|
||||
width="[(#ENV{width,720})]"
|
||||
height="[(#ENV{height,405})]"
|
||||
showinfo="showinfo [(#ENV{showinfo,1})]"
|
||||
autoplay="autoplay [(#ENV{autoplay,0})]"
|
||||
embedType="embedType [(#ENV{embedType,video})]">
|
||||
</div><br>]
|
@ -0,0 +1,5 @@
|
||||
[<div class="fb-video"
|
||||
data-href="https://www.facebook.com/watch/?v=(#ENV{id})"
|
||||
data-allowfullscreen="true"
|
||||
data-width="[(#ENV{width,500})]">
|
||||
</div><br>]
|
@ -0,0 +1,5 @@
|
||||
[<div class="gagenda_embed"
|
||||
width="[(#ENV{width,500})]"
|
||||
height="[(#ENV{height,450})]"
|
||||
data="src(#ENV{id})">
|
||||
</div>]
|
@ -0,0 +1,5 @@
|
||||
[<div class="vimeo_player"
|
||||
videoID="(#ENV{id})"
|
||||
width="[(#ENV{width,720})]"
|
||||
height="[(#ENV{height,405})]">
|
||||
</div><br>]
|
@ -0,0 +1,5 @@
|
||||
[<div class="webtvnu_player"
|
||||
videoID="(#ENV{id})"
|
||||
width="[(#ENV{width,720})]"
|
||||
height="[(#ENV{height,405})]">
|
||||
</div><br>]
|
@ -0,0 +1,15 @@
|
||||
[<div class="youtube_player"
|
||||
style="margin:auto"
|
||||
videoID="(#ENV{id})"
|
||||
width="[(#ENV{width,720})]"
|
||||
height="[(#ENV{height,405})]"
|
||||
theme="theme [(#ENV{theme,dark})]"
|
||||
rel="rel [(#ENV{rel,1})]"
|
||||
controls="controls [(#ENV{controls,1})]"
|
||||
showinfo="showinfo [(#ENV{showinfo,1})]"
|
||||
autoplay="autoplay [(#ENV{autoplay,0})]"
|
||||
mute="mute [(#ENV{mute,0})]"
|
||||
srcdoc="srcdoc"
|
||||
loop="loop [(#ENV{loop,0})]"
|
||||
loading="loading [(#ENV{loading,1})]">
|
||||
</div><br>]
|
@ -0,0 +1,25 @@
|
||||
#CACHE{3600*100,cache-client}
|
||||
#HTTP_HEADER{Content-Type: text/css; charset=utf-8}
|
||||
#HTTP_HEADER{Vary: Accept-Encoding}
|
||||
|
||||
#formulaire_configurer_tarteaucitron_ajouter_services .image_loading {
|
||||
float:none;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#formulaire_configurer_tarteaucitron_ajouter_services ol.explication {
|
||||
list-style-type: decimal;
|
||||
padding-left: 1.5rem;
|
||||
}
|
||||
|
||||
.formulaire_configurer_tarteaucitron_services .saisie_checkbox {
|
||||
padding-left:1rem;
|
||||
}
|
||||
|
||||
#tac_results li.item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-left: .5rem;
|
||||
padding-right: .5rem;
|
||||
}
|
@ -0,0 +1 @@
|
||||
(tarteaucitron.job = tarteaucitron.job || []).push('canalu');
|
@ -0,0 +1 @@
|
||||
(tarteaucitron.job = tarteaucitron.job || []).push('dailymotion');
|
@ -1,3 +1,3 @@
|
||||
tarteaucitron.user.facebookpixelId = '#CONFIG{tarteaucitron/services/fb_pixel}';
|
||||
tarteaucitron.user.facebookpixelId = '[(#CONFIG{tarteaucitron/services/facebookpixelID})]';
|
||||
tarteaucitron.user.facebookpixelMore = function () { /* add here your optionnal facebook pixel function */ };
|
||||
(tarteaucitron.job = tarteaucitron.job || []).push('facebookpixel');
|
@ -0,0 +1 @@
|
||||
(tarteaucitron.job = tarteaucitron.job || []).push('gagenda');
|
@ -1,2 +1,2 @@
|
||||
tarteaucitron.user.googlemapsKey = '#CONFIG{tarteaucitron/services/gmap}';
|
||||
tarteaucitron.user.googlemapsKey = '#CONFIG{tarteaucitron/services/gmapkey}';
|
||||
(tarteaucitron.job = tarteaucitron.job || []).push('googlemaps');
|
@ -1,3 +1,3 @@
|
||||
tarteaucitron.user.gtagUa = '#CONFIG{tarteaucitron/services/gtag}';
|
||||
tarteaucitron.user.gtagUa = '[(#CONFIG{tarteaucitron/services/gtagUA})]';
|
||||
tarteaucitron.user.gtagMore = function () { /* add here your optionnal gtag() */ };
|
||||
(tarteaucitron.job = tarteaucitron.job || []).push('gtag');
|
@ -0,0 +1 @@
|
||||
(tarteaucitron.job = tarteaucitron.job || []).push('vimeo');
|
@ -0,0 +1 @@
|
||||
(tarteaucitron.job = tarteaucitron.job || []).push('webtvnu');
|
@ -0,0 +1 @@
|
||||
(tarteaucitron.job = tarteaucitron.job || []).push('youtube');
|