Dotclear

Changeset 912:18eae8f3a180 for inc


Ignore:
Timestamp:
10/26/12 13:35:00 (13 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Add "republished" test attribute for EntryIf? tag and used in atom.xml. May be useful for theme creators in order to add a mention if a post has been modified since his publication. Fixes #1161.

Location:
inc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • inc/core/class.dc.rs.extensions.php

    r776 r912  
    165165     { 
    166166          return $rs->nb_trackback > 0; 
     167     } 
     168 
     169     /** 
     170     Returns whether post has been updated since publication. 
     171 
     172     @return <b>boolean</b> 
     173     */ 
     174     public static function isRepublished($rs) 
     175     { 
     176          return ($rs->getTS('upddt') + dt::getTimeOffset($rs->post_tz)) > $rs->getTS(); 
    167177     } 
    168178      
  • inc/public/class.dc.template.php

    r899 r912  
    12691269     show_comments  (0|1)     #IMPLIED  -- there are comments for this post (value : 1) or not (value : 0) 
    12701270     show_pings     (0|1)     #IMPLIED  -- there are trackbacks for this post (value : 1) or not (value : 0) 
     1271     republished    (0|1)     #IMPLIED  -- post has been updated since publication (value : 1) or not (value : 0) 
    12711272     operator  (and|or)  #IMPLIED  -- combination of conditions, if more than 1 specifiec (default: and) 
    12721273     url       CDATA     #IMPLIED  -- post has given url 
     
    13661367                    $if[] = '(!$_ctx->posts->hasTrackbacks() && !$_ctx->posts->trackbacksActive())'; 
    13671368               } 
     1369          } 
     1370           
     1371          if (isset($attr['republished'])) { 
     1372               $sign = (boolean) $attr['republished'] ? '' : '!'; 
     1373               $if[] = $sign.'(boolean)$_ctx->posts->isRepublished()'; 
    13681374          } 
    13691375           
  • inc/public/default-templates/atom.xml

    r0 r912  
    2525    <id>{{tpl:EntryFeedID}}</id> 
    2626    <published>{{tpl:EntryDate iso8601="1"}}</published> 
    27     <updated>{{tpl:EntryDate iso8601="1" upddt="1"}}</updated> 
     27    <tpl:EntryIf republished="1"> 
     28      <updated>{{tpl:EntryDate iso8601="1" upddt="1"}}</updated> 
     29    </tpl:EntryIf> 
     30    <tpl:EntryIf republished="0"> 
     31      <updated>{{tpl:EntryDate iso8601="1"}}</updated> 
     32    </tpl:EntryIf> 
    2833    <author><name>{{tpl:EntryAuthorCommonName encode_xml="1"}}</name></author> 
    2934    <tpl:EntryIf has_category="1"> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map