420 |
florian |
1 |
<?php
|
|
|
2 |
//=======Restes de wikini=====================================================================================================
|
|
|
3 |
$message = $this->GetMessage();
|
|
|
4 |
$user = $this->GetUser();
|
|
|
5 |
|
|
|
6 |
//On r�cupere le template et on execute les actions wikini
|
|
|
7 |
$template = file_get_contents('tools/templates/themes/'.$this->config['favorite_theme'].'/squelettes/'.$this->config['favorite_squelette'].'.tpl.html');
|
|
|
8 |
$template_decoupe = explode("{WIKINI_PAGE}", $template);
|
|
|
9 |
if ($act=preg_match_all ("/".'(\\{\\{)'.'(.*?)'.'(\\}\\})'."/is", $template_decoupe[0], $matches)) {
|
|
|
10 |
$i = 0; $j = 0;
|
|
|
11 |
foreach($matches as $valeur) {
|
|
|
12 |
foreach($valeur as $val) {
|
|
|
13 |
if ($matches[2][$j]!='') {
|
|
|
14 |
$action= $matches[2][$j];
|
|
|
15 |
$template=str_replace('{{'.$action.'}}', $this->Format('{{'.$action.'}}'), $template_decoupe[0]);
|
|
|
16 |
}
|
|
|
17 |
$j++;
|
|
|
18 |
}
|
|
|
19 |
$i++;
|
|
|
20 |
}
|
|
|
21 |
}
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
//on utilise la bibliotheque pear template it pour gerer les variables dans la template
|
|
|
25 |
require_once 'tools/templates/api/IT.php';
|
|
|
26 |
$tpl = new HTML_Template_IT('tools/templates/themes/'.$this->config['favorite_theme'].'/squelettes');
|
|
|
27 |
$tpl->setTemplate($template, true, true);
|
|
|
28 |
|
|
|
29 |
//on assigne les valeurs aux variables du template
|
|
|
30 |
|
|
|
31 |
//titre de la page
|
|
|
32 |
$wikini_titre=$this->GetWakkaName().":".$this->GetPageTag();
|
|
|
33 |
$tpl->setVariable('WIKINI_TITRE', $wikini_titre);
|
|
|
34 |
|
|
|
35 |
// meta robots
|
|
|
36 |
if ($this->GetMethod() != 'show') $wikini_meta_robots="<meta name=\"robots\" content=\"noindex, nofollow\"/>\n";
|
|
|
37 |
if (isset($wikini_meta_robots)) $tpl->setVariable('WIKINI_META_ROBOTS', $wikini_meta_robots);
|
|
|
38 |
|
|
|
39 |
//mots cles
|
|
|
40 |
$wikini_mots_cles = $this->config['meta_keywords'];
|
|
|
41 |
$tpl->setVariable('WIKINI_MOTS_CLES', $wikini_mots_cles);
|
|
|
42 |
|
|
|
43 |
//description
|
|
|
44 |
$wikini_description = $this->config['meta_description'];
|
|
|
45 |
$tpl->setVariable('WIKINI_DESCRIPTION', $wikini_description);
|
|
|
46 |
|
|
|
47 |
//feuilles de styles
|
|
|
48 |
$wikini_styles_css = '';
|
|
|
49 |
if ($this->config['favorite_style']!='none') $wikini_styles_css .= '<link rel="stylesheet" type="text/css" href="tools/templates/themes/'.$this->config['favorite_theme'].'/styles/'.$this->config['favorite_style'].'" media="screen" title="'.$this->config['favorite_style'].'" />'."\n";
|
|
|
50 |
foreach($this->config['styles'] as $key => $value) {
|
|
|
51 |
if($key !== $this->config['favorite_style'] && $key !== 'none') {
|
|
|
52 |
$wikini_styles_css .= '<link rel="alternate stylesheet" type="text/css" href="tools/templates/themes/'.$this->config['favorite_theme'].'/styles/'.$key.'" media="screen" title="'.$value.'" />'."\n";
|
|
|
53 |
}
|
|
|
54 |
}
|
|
|
55 |
$tpl->setVariable('WIKINI_STYLES_CSS', $wikini_styles_css);
|
|
|
56 |
|
|
|
57 |
//javascripts
|
|
|
58 |
$wikini_javascripts = '';
|
|
|
59 |
$repertoire = 'tools/templates/themes/'.$this->config['favorite_theme'].'/javascripts';
|
|
|
60 |
$dir = opendir($repertoire);
|
|
|
61 |
while (false !== ($file = readdir($dir))) {
|
|
|
62 |
if (substr($file, -3, 3)=='.js') $scripts[] = '<script type="text/javascript" src="'.$repertoire.'/'.$file.'"></script>'."\n";
|
|
|
63 |
}
|
|
|
64 |
asort($scripts);
|
|
|
65 |
foreach ($scripts as $key => $val) {
|
|
|
66 |
$wikini_javascripts .= "$val\n";
|
|
|
67 |
}
|
|
|
68 |
closedir($dir);
|
|
|
69 |
if ($wikini_javascripts!='') $tpl->setVariable('WIKINI_JAVASCRIPTS', $wikini_javascripts);
|
|
|
70 |
|
|
|
71 |
|
|
|
72 |
//attributs du body
|
|
|
73 |
$wikini_body = $message ? "onLoad=\"alert('".$message."');\" " : "";
|
|
|
74 |
$tpl->setVariable('WIKINI_BODY', $wikini_body);
|
|
|
75 |
|
|
|
76 |
//nom du site
|
|
|
77 |
$wikini_titre_site = $this->config["wakka_name"] ;
|
|
|
78 |
$tpl->setVariable('WIKINI_TITRE_SITE', $wikini_titre_site);
|
|
|
79 |
|
|
|
80 |
//remise a zero des styles css
|
|
|
81 |
$wikini_resetstyle .= $this->href().'/resetstyle';
|
|
|
82 |
$tpl->setVariable('WIKINI_RESETSTYLE', $wikini_resetstyle);
|
|
|
83 |
|
|
|
84 |
//javascript du double clic
|
|
|
85 |
$wikini_double_clic = "ondblclick=\"document.location='".$this->href("edit")."';\" ";
|
|
|
86 |
$tpl->setVariable('WIKINI_DOUBLE_CLIC', $wikini_double_clic);
|
|
|
87 |
|
|
|
88 |
$plugin_output_new = $tpl->show();
|