219
219
echo plxUtils::strCheck($this->plxMotor->aStats[$this->plxMotor->cible ]['name'].' - '.$this->plxMotor->aConf['title']);
222
if($this->plxMotor->mode == 'archives') {
222
if($this->plxMotor->mode == 'archives') {
223
223
preg_match('/^(\d{4})(\d{2})?(\d{2})?/',$this->plxMotor->cible, $capture);
224
224
$year = !empty($capture[1]) ? ' '.$capture[1] : '';
225
225
$month = !empty($capture[2]) ? ' '.plxDate::getCalendar('month', $capture[2]) : '';
226
226
$day = !empty($capture[3]) ? ' '.plxDate::getCalendar('day', $capture[3]) : '';
227
echo plxUtils::strCheck(L_PAGETITLE_ARCHIVES.$day.$month.$year.' - '.$this->plxMotor->aConf['title']);
230
if($this->plxMotor->mode == 'tags') {
231
echo plxUtils::strCheck(L_PAGETITLE_TAG.' '.$this->plxMotor->cible.' - '.$this->plxMotor->aConf['title']);
227
echo plxUtils::strCheck(L_PAGETITLE_ARCHIVES.$day.$month.$year.' - '.$this->plxMotor->aConf['title']);
230
if($this->plxMotor->mode == 'tags') {
231
echo plxUtils::strCheck(L_PAGETITLE_TAG.' '.$this->plxMotor->cibleName.' - '.$this->plxMotor->aConf['title']);
234
234
if($this->plxMotor->mode == 'erreur') {
235
235
echo plxUtils::strCheck($this->plxMotor->plxErreur->getMessage().' - '.$this->plxMotor->aConf['title']);
562
562
* Méthode qui affiche la date de publication de l'article selon le format choisi
564
* @param format format du texte de la date (variable: #minute, #hour, #day, #month, #num_day, #num_month, #num_year(4), #num_year(2))
564
* @param format format du texte de la date (variable: #minute, #hour, #day, #month, #num_day, #num_month, #num_year(4), #num_year(2))
566
566
* @scope home,categorie,article,tags,archives
567
567
* @author Stephane F.
626
627
$active = "noactive";
627
628
# On effectue l'affichage
628
echo '<a class="'.$active.'" href="'.$this->plxMotor->urlRewrite('?categorie'.intval($catId).'/'.$url).'" title="'.$name.'">'.$name.'</a>';
629
$cats[] = '<a class="'.$active.'" href="'.$this->plxMotor->urlRewrite('?categorie'.intval($catId).'/'.$url).'" title="'.$name.'">'.$name.'</a>';
629
630
} else { # La categorie n'existe pas
631
$cats[] = L_UNCLASSIFIED;
632
633
} else { # Categorie "home"
633
echo '<a class="active" href="'.$this->plxMotor->urlRewrite().'" title="'.L_HOMEPAGE.'">'.L_HOMEPAGE.'</a>';
634
$cats[] = '<a class="active" href="'.$this->plxMotor->urlRewrite().'" title="'.L_HOMEPAGE.'">'.L_HOMEPAGE.'</a>';
635
if ($idx!=sizeof($catIds)-1) echo $separator.' ';
637
echo implode($separator, $cats);
640
641
* Méthode qui affiche la liste des tags l'article sous forme de lien
642
643
* @param format format du texte pour chaque tag (variable : #tag_status, #tag_url, #tag_name)
643
* @param separator caractère de séparation entre les tags affichées
644
* @param separator caractère de séparation entre les tags affichées
645
646
* @scope home,categorie,article,tags,archives
646
647
* @author Stephane F
670
* Méthode qui affiche le lien "Lire la suite" si le chapô de l'article est renseigné
672
* @param format format d'affichage du lien pour lire la suite de l'article (#art_url, #art_title)
674
* @scope home,categorie,tags,archives
677
public function artReadMore($format='') {
679
# Affichage du lien "Lire la suite" si un chapo existe
680
if($this->plxMotor->plxRecord_arts->f('chapo') != '') {
681
$format = ($format=='' ? '<p class="more"><a href="#art_url" title="#art_title">'.L_ARTCHAPO.'</a></p>' : $format);
683
# On recupere les infos de l'article
684
$id = intval($this->plxMotor->plxRecord_arts->f('numero'));
685
$title = plxUtils::strCheck($this->plxMotor->plxRecord_arts->f('title'));
686
$url = $this->plxMotor->plxRecord_arts->f('url');
687
# Formatage de l'affichage
688
$row = str_replace("#art_url", $this->plxMotor->urlRewrite('?article'.$id.'/'.$url), $format);
689
$row = str_replace("#art_title", $title, $row);
669
696
* Méthode qui affiche le châpo de l'article ainsi qu'un lien
670
697
* pour lire la suite de l'article. Si l'article n'a pas de chapô,
671
698
* le contenu de l'article est affiché (selon paramètres)
809
836
* @param max nombre d'articles maximum
810
837
* @param cat_id ids des catégories cible
811
838
* @param ending texte à ajouter en fin de ligne
839
* @param sort tri de l'affichage des articles (sort|rsort|alpha)
814
842
* @author Florent MONTHEL, Stephane F
816
public function lastArtList($format='<li><a href="#art_url" title="#art_title">#art_title</a></li>',$max=5,$cat_id='',$ending='') {
844
public function lastArtList($format='<li><a href="#art_url" title="#art_title">#art_title</a></li>',$max=5,$cat_id='',$ending='', $sort='rsort') {
818
846
if(eval($this->plxMotor->plxPlugins->callHook('plxShowLastArtList'))) return;
819
847
# Génération de notre motif
825
853
# Nouvel objet plxGlob et récupération des fichiers
826
854
$plxGlob_arts = clone $this->plxMotor->plxGlob_arts;
827
if($aFiles = $plxGlob_arts->query($motif,'art','rsort',0,$max,'before')) {
855
if($aFiles = $plxGlob_arts->query($motif,'art',$sort,0,$max,'before')) {
828
856
foreach($aFiles as $v) { # On parcourt tous les fichiers
829
857
$art = $this->plxMotor->parseArticle(PLX_ROOT.$this->plxMotor->aConf['racine_articles'].$v);
830
858
$num = intval($art['numero']);
850
878
$row = str_replace('#cat_list', implode(', ',$catList), $row);
851
879
$row = str_replace('#art_url',$this->plxMotor->urlRewrite('?article'.$num.'/'.$art['url']),$row);
852
880
$row = str_replace('#art_status',$status,$row);
853
$author = plxUtils::getValue($this->plxMotor->aUsers[$art['author']]['name']);
854
$row = str_replace('#art_author',plxUtils::strCheck($author),$row);
881
$author = plxUtils::getValue($this->plxMotor->aUsers[$art['author']]['name']);
882
$row = str_replace('#art_author',plxUtils::strCheck($author),$row);
855
883
$row = str_replace('#art_title',plxUtils::strCheck($art['title']),$row);
856
884
$strlength = preg_match('/#art_chapo\(([0-9]+)\)/',$row,$capture) ? $capture[1] : '100';
857
885
$chapo = plxUtils::truncate($art['chapo'],$strlength,$ending,true,true);
1078
1106
$date = $com['date'];
1079
1107
$content = strip_tags($com['content']);
1080
1108
# On modifie nos motifs
1081
$row = str_replace('#com_id',$com['numero'],$format);
1109
$row = str_replace('L_SAID', L_SAID, $format);
1110
$row = str_replace('#com_id',$com['numero'],$row);
1082
1111
$row = str_replace('#com_url',$this->plxMotor->urlRewrite($url),$row);
1083
1112
$row = str_replace('#com_author',$com['author'],$row);
1084
1113
while(preg_match('/#com_content\(([0-9]+)\)/',$row,$capture)) {
1105
1134
* Méthode qui affiche la liste des pages statiques.
1106
* Si la variable $extra est renseignée, un lien vers la
1107
* page d'accueil (nommé $extra) sera mis en place en première position
1109
* @param extra nom du lien vers la page d'accueil
1110
* @param format format du texte pour chaque page (variable : #static_id, #static_status, #static_url, #static_name, #group_di, #group_class, #group_name)
1136
* @param extra si renseigné: nom du lien vers la page d'accueil affiché en première position
1137
* @param format format du texte pour chaque page (variable : #static_id, #static_status, #static_url, #static_name, #group_id, #group_class, #group_name)
1138
* @param menublog position du menu Blog (si non renseigné le menu n'est pas affiché)
1111
1139
* @return stdout
1112
1140
* @scope global
1113
* @author Florent MONTHEL, Stephane F
1141
* @author Stephane F
1115
public function staticList($extra='', $format='<li id="#static_id" class="#static_class"><a href="#static_url" class="#static_status" title="#static_name">#static_name</a></li>', $format_group='<li id="#group_id" class="#group_class">#group_name</li>') {
1143
public function staticList($extra='', $format='<li id="#static_id" class="#static_class"><a href="#static_url" class="#static_status" title="#static_name">#static_name</a></li>', $format_group='<span class="#group_class">#group_name</span>', $menublog=false) {
1117
1145
$menus = array();
1120
1147
if(eval($this->plxMotor->plxPlugins->callHook('plxShowStaticListBegin'))) return;
1121
1148
$home = ((empty($this->plxMotor->get) OR preg_match('/^page[0-9]*/',$this->plxMotor->get)) AND basename($_SERVER['SCRIPT_NAME'])=="index.php");
1126
1153
$stat = str_replace('#static_url',$this->plxMotor->urlRewrite(),$stat);
1127
1154
$stat = str_replace('#static_name',plxUtils::strCheck($extra),$stat);
1128
1155
$stat = str_replace('#static_status',($home==true?"active":"noactive"), $stat);
1133
# On verifie qu'il y a des pages statiques
1134
1158
if($this->plxMotor->aStats) {
1136
1159
foreach($this->plxMotor->aStats as $k=>$v) {
1137
1160
if($v['active'] == 1 AND $v['menu'] == 'oui') { # La page est bien active et dispo ds le menu
1138
# On modifie nos motifs
1139
if(!empty($v['group']) AND $group_name!=$v['group']) {
1140
$group = str_replace('#group_id','static-group-'.plxUtils::title2url($v['group']),$format_group);
1141
$group = str_replace('#group_class','static-group',$group);
1142
$group = str_replace('#group_name',plxUtils::strCheck($v['group']),$group);
1145
1161
$stat = str_replace('#static_id','static-'.intval($k),$format);
1146
if(empty($v['group']))
1147
$stat = str_replace('#static_class','static-group',$stat);
1149
$stat = str_replace('#static_class','static-menu',$stat);
1150
if(plxUtils::checkSite($v['url'],false))
1162
$stat = str_replace('#static_class','static-menu',$stat);
1163
if($v['url'][0]=='?') # url interne commençant par ?
1164
$stat = str_replace('#static_url',$this->plxMotor->urlRewrite($v['url']),$stat);
1165
elseif(plxUtils::checkSite($v['url'],false)) # url externe en http ou autre
1151
1166
$stat = str_replace('#static_url',$v['url'],$stat);
1167
else # url page statique
1153
1168
$stat = str_replace('#static_url',$this->plxMotor->urlRewrite('?static'.intval($k).'/'.$v['url']),$stat);
1154
1169
$stat = str_replace('#static_name',plxUtils::strCheck($v['name']),$stat);
1155
1170
$stat = str_replace('#static_status',(($home===false AND $this->staticId()==intval($k))?'static active':'noactive'), $stat);
1157
$group_name=$v['group']; # pour gérer la rupture au niveau de l'affichage
1174
$menus[$v['group']][] = $stat;
1179
if($this->plxMotor->aConf['homestatic']!='' AND isset($this->plxMotor->aStats[$this->plxMotor->aConf['homestatic']])) {
1180
if($this->plxMotor->aStats[$this->plxMotor->aConf['homestatic']]['active']) {
1181
$menu = str_replace('#static_id','page-blog',$format);
1182
if ($this->plxMotor->get AND preg_match('/^(blog|categorie|archives|tag|article)/', $_SERVER['QUERY_STRING'])) {
1183
$menu = str_replace('#static_status','active',$menu);
1185
$menu = str_replace('#static_status','noactive',$menu);
1187
$menu = str_replace('#static_url', $this->plxMotor->urlRewrite('?blog'),$menu);
1188
$menu = str_replace('#static_name',L_PAGEBLOG_TITLE,$menu);
1189
array_splice($menus, (intval($menublog)-1), 0, array($menu));
1163
1195
if(eval($this->plxMotor->plxPlugins->callHook('plxShowStaticListEnd'))) return;
1165
echo implode('', $menus);
1197
# Affichage des pages statiques + menu Accueil et Blog
1199
foreach($menus as $k=>$v) {
1200
if(is_numeric($k)) {
1201
echo "\n".(is_array($v) ? $v[0] : $v);
1204
$group = str_replace('#group_id','static-group-'.plxUtils::title2url($k),$format_group);
1205
$group = str_replace('#group_class','static group',$group);
1206
$group = str_replace('#group_name',plxUtils::strCheck($k),$group);
1207
echo "\n<li>\n\t".$group."\n\t<ul id=\"static-".plxUtils::title2url($k)."\">\t\t";
1208
foreach($v as $kk => $vv) {
1211
echo "\n\t</ul>\n</li>\n";
1564
1631
$theme = $this->plxMotor->aConf['racine_themes'].$this->plxMotor->style.'/';
1565
1632
$css = str_replace('php','css',$this->plxMotor->template);
1566
1633
if(is_file($theme.$css_dir.$css))
1567
echo "\t".'<link rel="stylesheet" type="text/css" href="'.$this->plxMotor->urlRewrite($theme.$css_dir.$css).'" media="screen" />'."\n";
1634
echo '<link rel="stylesheet" type="text/css" href="'.$this->plxMotor->urlRewrite($theme.$css_dir.$css).'" media="screen" />'."\n";
1638
* Méthode qui ajoute, s'il existe, le fichier css associé aux plugins
1642
* @author Stephane F
1644
public function pluginsCss() {
1646
if(eval($this->plxMotor->plxPlugins->callHook('plxShowPluginsCss'))) return;
1648
$filename = $this->plxMotor->aConf['racine_plugins'].'site.css';
1649
if(is_file(PLX_ROOT.$filename))
1650
echo '<link rel="stylesheet" type="text/css" href="'.$this->plxMotor->urlRewrite($filename).'" media="screen" />'."\n";