[ Index ]
 

Code source de Dotclear 1.2.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/layout/ -> class.xblogpost.php (source)

   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 blogpost
  25  #
  26  
  27  class xblogpost extends blogpost
  28  {
  29      # Contenu (avec ou sans smilies)
  30  	function getContent()
  31      {
  32          if ($this->blog->use_smilies)    {
  33              return $this->blog->addSmilies($this->f('post_content'));
  34          } else {
  35              return $this->f('post_content');
  36          }
  37      }
  38      
  39  	function getChapo()
  40      {
  41          if ($this->blog->use_smilies)    {
  42              return $this->blog->addSmilies($this->f('post_chapo'));
  43          } else {
  44              return $this->f('post_chapo');
  45          }
  46      }
  47      
  48      
  49  	function openComment()
  50      {
  51          return (
  52              dc_allow_comments && $this->f('post_open_comment') &&
  53              (dc_comments_ttl == 0 ||
  54              time()-(dc_comments_ttl*86400) < $this->getTS())
  55              );
  56      }
  57      
  58  	function openTb()
  59      {
  60          return (
  61              dc_allow_trackbacks && $this->f('post_open_tb') &&
  62              (dc_comments_ttl == 0 ||
  63              time()-(dc_comments_ttl*86400) < $this->getTS())
  64              );
  65      }
  66      
  67      # Liens vers tous les billets pour l'en tête
  68  	function getHeadLinks()
  69      {
  70          $res = '';
  71          
  72          $index = $this->int_index;
  73          $this->moveStart();
  74          
  75          while (!$this->EOF())
  76          {
  77              $res .= '<link rel="chapter" href="'.$this->getPermURL().'" '.
  78              'title="'.$this->f('post_titre').'" />'."\n";
  79              $this->moveNext();
  80          }
  81          $this->move($index);
  82          
  83          return $res;
  84      }
  85      
  86  	function nbComments($zero,$one,$more)
  87      {
  88          $nb = $this->f('nb_comment');
  89          
  90          if($nb == 0) {
  91              return $zero;
  92          } elseif($nb == 1) {
  93              return $one;
  94          } elseif($nb > 1) {
  95              return sprintf($more,$nb);
  96          }
  97      }
  98      
  99  	function firstPostOfDay()
 100      {
 101          $prev_dt = NULL;
 102          if($this->movePrev()) {
 103              $prev_dt = $this->getLDate();
 104              $this->moveNext();
 105          }
 106          
 107          if($prev_dt == NULL || $prev_dt != $this->getLDate()) {
 108              return true;
 109          } else {
 110              return false;
 111          }
 112      }
 113      
 114  	function getRSSSeq()
 115      {
 116          return '  <rdf:li rdf:resource="'.$this->getPermURL().'" />'."\n";
 117      }
 118      
 119  	function getRSSItem($short=false)
 120      {
 121          if ($this->f('post_chapo') != '') {
 122              $desc = strip_tags($this->f('post_chapo'));
 123          } else {
 124              $desc = util::cutString(strip_tags($this->f('post_content')),300).'...';
 125          }
 126          
 127          if ($short) {
 128              $content = $desc;
 129          } else {
 130              $content = $this->f('post_chapo').' '.$this->f('post_content');
 131          }
 132          
 133          return
 134          '<item rdf:about="'.$this->getPermURL().'">'."\n".
 135          '  <title>'.$this->blog->toXML($this->f('post_titre'))."</title>\n".
 136          '  <link>'.$this->getPermURL()."</link>\n".
 137          '  <dc:date>'.$this->getIsoDate()."</dc:date>\n".
 138          (($this->f('post_lang')) ? '  <dc:language>'.$this->f('post_lang')."</dc:language>\n" : '').
 139          '  <dc:creator>'.htmlspecialchars($this->getUserCN())."</dc:creator>\n".
 140          '  <dc:subject>'.htmlspecialchars($this->f('cat_libelle'))."</dc:subject>\n".
 141          '  <description>'.$this->blog->toXML($desc)."</description>\n".
 142          '  <content:encoded><![CDATA['.$content."]]></content:encoded>\n".
 143          '</item>'."\n";
 144      }
 145      
 146  	function getAtomEntry($short=false)
 147      {
 148          if ($this->f('post_chapo') != '') {
 149              $desc = strip_tags($this->f('post_chapo'));
 150          } else {
 151              $desc = util::cutString(strip_tags($this->f('post_content')),300).'...';
 152          }
 153          
 154          if ($short) {
 155              $content = $desc;
 156          } else {
 157              $content = $this->f('post_chapo').' '.$this->f('post_content');
 158          }
 159          
 160          $id = 'tag:'.htmlspecialchars($_SERVER['HTTP_HOST']).','.date('Y-m-d',$this->getTS()).
 161                  ':'.dc_app_url.'/'.$this->f('post_id');
 162          
 163          return
 164          '<entry' .
 165          (($this->f('post_lang')) ? ' xml:lang="'.$this->f('post_lang').'"' : '').
 166          '>'."\n".
 167          '  <title>'.$this->blog->toXML($this->f('post_titre'))."</title>\n".
 168          '  <link rel="alternate" type="text/html" href="'.$this->getPermURL().'" />'."\n".
 169          '  <updated>'.$this->getIsoDate()."</updated>\n".
 170          '  <id>'.$id."</id>\n".
 171          '  <author><name>'.htmlspecialchars($this->getUserCN())."</name></author>\n".
 172          '  <category term="'.$this->f('cat_libelle_url').'" label="'.$this->blog->toXML($this->f('cat_libelle')).'"'."/>\n".
 173          '  <summary>'.$this->blog->toXML($desc)."</summary>\n".
 174          '  <content type="html">'.htmlspecialchars($content)."</content>\n".
 175          '</entry>'."\n";
 176      }
 177  }
 178  ?>


Généré le : Fri Feb 23 21:40:15 2007 par Balluche grâce à PHPXref 0.7