[ Index ] |
|
Code source de Dotclear 1.2.5 |
1 <?php 2 # ***** BEGIN LICENSE BLOCK ***** 3 # This file is part of DotClear. 4 # Copyright (c) 2004 Olivier Meunier and contributors. All rights 5 # reserved. 6 # 7 # DotClear is free software; you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation; either version 2 of the License, or 10 # (at your option) any later version. 11 # 12 # DotClear is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with DotClear; if not, write to the Free Software 19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 # 21 # ***** END LICENSE BLOCK ***** 22 23 # 24 # Extension de la classe blogcomment 25 26 class xblogcomment extends blogcomment 27 { 28 # Extraction des trackbacks dans un autre recordset 29 function extractTrackbacks() 30 { 31 $res = array(); 32 foreach ($this->arry_data as $k => $v) 33 { 34 if ($v['comment_trackback'] == 1) { 35 $res[] = $v; 36 unset($this->arry_data[$k]); 37 } 38 } 39 40 $this->recordSet(array_values($this->arry_data)); 41 42 $rs = new xblogcomment($res); 43 $rs->setBlog($this->blog); 44 return $rs; 45 } 46 47 function auteurLink() 48 { 49 if($this->f('comment_email') != '') { 50 return $this->getEncodMail(); 51 } else { 52 return false; 53 } 54 } 55 56 function auteurSite() 57 { 58 if($this->f('comment_site') != '') { 59 return 'http://'.$this->f('comment_site'); 60 } else { 61 return false; 62 } 63 } 64 65 function xGetContent() 66 { 67 if ($this->blog->use_smilies) { 68 return $this->blog->addSmilies($this->getContent()); 69 } else { 70 return $this->getContent(); 71 } 72 } 73 74 function getRSSSeq() 75 { 76 return ' <rdf:li rdf:resource="'.$this->getPermURL().'" />'."\n"; 77 } 78 79 function getRSSItem($short=false) 80 { 81 $tb = (boolean) $this->f('comment_trackback'); 82 83 $desc = util::cutString(strip_tags($this->getContent()),300).'...'; 84 85 $content = ($short) ? $desc : $this->getContent(); 86 87 return 88 '<item rdf:about="'.$this->getPermURL().'">'."\n". 89 ' <title>'.($tb ? 'trackback - ' : ''). 90 $this->blog->toXML($this->f('post_titre')).' - '. 91 $this->blog->toXML($this->f('comment_auteur'))."</title>\n". 92 ' <link>'.$this->getPermURL()."</link>\n". 93 ' <dc:date>'.$this->getIsoDate()."</dc:date>\n". 94 ' <dc:creator>'.htmlspecialchars($this->f('comment_auteur'))."</dc:creator>\n". 95 ' <description>'.$this->blog->toXML($desc)."</description>\n". 96 ' <content:encoded><![CDATA['.$content."]]></content:encoded>\n". 97 '</item>'."\n"; 98 } 99 100 function getAtomEntry($short=false) 101 { 102 $tb = (boolean) $this->f('comment_trackback'); 103 104 if ($short) { 105 $content = util::cutString(strip_tags($this->getContent()),300).'...'; 106 } else { 107 $content = $this->getContent(); 108 } 109 110 $id = 'tag:'.htmlspecialchars($_SERVER['HTTP_HOST']).','.date('Y-m-d',$this->getTS()). 111 ':'.dc_app_url.'/'.$this->f('post_id').'/'.$this->f('comment_id'); 112 113 return 114 '<entry>'."\n". 115 ' <title>'.($tb ? 'trackback - ' : ''). 116 $this->blog->toXML($this->f('post_titre')).' - '. 117 $this->blog->toXML($this->f('comment_auteur'))."</title>\n". 118 ' <link rel="alternate" type="text/html" href="'.$this->getPermURL().'"/>'."\n". 119 ' <updated>'.$this->getIsoDate()."</updated>\n". 120 ' <id>'.$id."</id>\n". 121 ' <author><name>'.htmlspecialchars($this->f('comment_auteur'))."</name></author>\n". 122 ' <content type="html">'.htmlspecialchars($content)."</content>\n". 123 '</entry>'."\n"; 124 } 125 } 126 127 128 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Feb 23 21:40:15 2007 | par Balluche grâce à PHPXref 0.7 |