-
Notifications
You must be signed in to change notification settings - Fork 0
/
tetue_trousse_pipelines.php
66 lines (59 loc) · 2.03 KB
/
tetue_trousse_pipelines.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
function tetue_trousse_insert_head_css($flux) {
$flux .= '<link rel="stylesheet" type="text/css" href="'.find_in_path('css/tetue_trousse.css').'" media="all" />'."\n";
return $flux;
}
// Belles Puces ameliorees
function tetue_trousse_pre_typo($texte) {
$texte = preg_replace('/^-\s+/m','-* ',$texte);
$texte = preg_replace('/^[*]\s+/m','- ',$texte);
return $texte;
}
/**
* Previsualisation pour les redacteurs
* (c) 2008 Cedric MORIN
* Licence GPL 3
*
*/
function tetue_trousse_pre_boucle(&$boucle){
// deja integre dans SPIP3 et code pas compatible qui plus est
if (intval($GLOBALS['spip_version_branche'])<3){
$id_table = $boucle->id_table;
$mstatut = $id_table .'.statut';
if (!isset($boucle->modificateur['criteres']['statut'])){
switch ($boucle->type_requete){
case 'articles':
if (!$GLOBALS['var_preview']) {
if ($GLOBALS['meta']["post_dates"] == 'non')
array_unshift($boucle->where,array("'<'", "'$id_table" . ".date'", "sql_quote(quete_date_postdates())"));
array_unshift($boucle->where,array("'='", "'$mstatut'", "'\\'publie\\''"));
} else
array_unshift($boucle->where,array("'IN'", "'$mstatut'", "'(\\'publie\\',\\'prop\\',\\'prepa\\')'"));
$boucle->modificateur['criteres']['statut'] = true;
break;
}
}
}
return $boucle;
}
function tetue_trousse_boite_infos(&$flux){
if ($flux['args']['type']=='article'
AND $id_article=intval($flux['args']['id'])
AND $statut = $flux['args']['row']['statut']
AND $statut == 'prepa'
AND autoriser('previsualiser')){
$message = _T('previsualiser');
$h = generer_url_action('redirect', "type=article&id=$id_article&var_mode=preview");
$previsu =
//icone_inline($message, $h, $image, "rien.gif", $GLOBALS['spip_lang_left'])
icone_horizontale($message, $h, "racine-24.gif", "rien.gif",false);
if ($p = strpos($flux['data'],'</ul>')){
while($q = strpos($flux['data'],'</ul>',$p+5)) $p=$q;
$flux['data'] = substr($flux['data'],0,$p+5).$previsu.substr($flux['data'],$p+5);
}
else
$flux['data'].= $previsu;
}
return $flux;
}
?>