Dotclear

Changeset 3167:9b0e5988c0eb for inc


Ignore:
Timestamp:
02/11/16 15:35:39 (9 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Cope with sort of "un-attached" media → allows new features as "featured media" plugin. Video and Audio HTML5 element are now used (if possible) rather than Flash object for attachments.

Location:
inc
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • inc/core/class.dc.media.php

    r3138 r3167  
    573573     fileItems objects. 
    574574 
    575      @param    post_id   <b>integer</b>      Post ID 
     575     @param    post_id        <b>integer</b>      Post ID 
    576576     @param    media_id  <b>integer</b>      Optionnal media ID 
     577     @param    link_type <b>string</b>       Optionnal link type 
    577578     @return   <b>array</b> Array of fileItems 
    578579     */ 
    579      public function getPostMedia($post_id,$media_id=null) 
     580     public function getPostMedia($post_id,$media_id=null,$link_type=null) 
    580581     { 
    581582          $params = array( 
     
    586587               $params['media_id'] = (integer) $media_id; 
    587588          } 
     589          if ($link_type) { 
     590               $params['link_type'] = $link_type; 
     591          } 
    588592          $rs = $this->postmedia->getPostMedia($params); 
    589593 
     
    604608     @see dcPostMedia::addPostMedia 
    605609     */ 
    606      public function addPostMedia($post_id,$media_id) 
    607      { 
    608           $this->postmedia->addPostMedia($post_id,$media_id); 
     610     public function addPostMedia($post_id,$media_id,$link_type='attachment') 
     611     { 
     612          $this->postmedia->addPostMedia($post_id,$media_id,$link_type); 
    609613     } 
    610614 
     
    613617     @see dcPostMedia::removePostMedia 
    614618     */ 
    615      public function removePostMedia($post_id,$media_id) 
    616      { 
    617           $this->postmedia->removePostMedia($post_id,$media_id,"attachment"); 
     619     public function removePostMedia($post_id,$media_id,$link_type='attachment') 
     620     { 
     621          $this->postmedia->removePostMedia($post_id,$media_id,$link_type); 
    618622     } 
    619623 
  • inc/core/class.dc.postmedia.php

    r2566 r3167  
    7878               $strReq .= $params['sql']; 
    7979          } 
    80      //echo $strReq; exit; 
     80 
    8181          $rs = $this->con->select($strReq); 
    8282 
     
    8787     Attaches a media to a post. 
    8888 
    89      @param    post_id   <b>integer</b>      Post ID 
     89     @param    post_id        <b>integer</b>      Post ID 
    9090     @param    media_id  <b>integer</b>      Optionnal media ID 
     91     @param    link_type <b>string</b>       Optionnal link type (default: attachment) 
    9192     */ 
    9293     public function addPostMedia($post_id,$media_id,$link_type='attachment') 
     
    113114     Detaches a media from a post. 
    114115 
    115      @param    post_id   <b>integer</b>      Post ID 
     116     @param    post_id        <b>integer</b>      Post ID 
    116117     @param    media_id  <b>integer</b>      Optionnal media ID 
     118     @param    link_type <b>string</b>       Optionnal link type 
    117119     */ 
    118120     public function removePostMedia($post_id,$media_id,$link_type=null) 
  • inc/core/class.dc.rs.extensions.php

    r3106 r3167  
    447447     @return   <b>integer</b> 
    448448     */ 
    449      public static function countMedia($rs) 
     449     public static function countMedia($rs,$link_type=null) 
    450450     { 
    451451          if (isset($rs->_nb_media[$rs->index()])) 
     
    459459               'FROM '.$rs->core->prefix.'post_media '. 
    460460               'WHERE post_id = '.(integer) $rs->post_id.' '; 
     461               if ($link_type != null) { 
     462                    $strReq .= "AND link_type = '".$rs->core->con->escape($link_type)."'"; 
     463               } 
    461464 
    462465               $res = (integer) $rs->core->con->select($strReq)->f(0); 
  • inc/public/default-templates/currywurst/_entry-content.html

    r2938 r3167  
    4646     </tpl:AttachmentsHeader> 
    4747                    <li class="post-attachments-item {{tpl:AttachmentType}}"> 
    48                          <tpl:AttachmentIf is_mp3="1"> 
    49                               {{tpl:include src="_mp3_player.html"}} - 
     48                         <tpl:AttachmentIf is_audio="1"> 
     49                              {{tpl:include src="_audio_player.html"}} 
    5050                         </tpl:AttachmentIf> 
    51                          <tpl:AttachmentIf is_flv="1"> 
    52                               {{tpl:include src="_flv_player.html"}} 
     51                         <tpl:AttachmentIf is_video="1"> 
     52                              <tpl:AttachmentIf is_flv="0"> 
     53                                   {{tpl:include src="_video_player.html"}} 
     54                              {{tpl:else}} 
     55                                   {{tpl:include src="_flv_player.html"}} 
     56                              </tpl:AttachmentIf> 
    5357                         </tpl:AttachmentIf> 
    54                          <tpl:AttachmentIf is_flv="0"> 
     58                         <tpl:AttachmentIf is_video="0" is_audio="0"> 
    5559                              <a href="{{tpl:AttachmentURL}}" 
    5660                               title="{{tpl:AttachmentFileName}} ({{tpl:AttachmentSize}})">{{tpl:AttachmentTitle}}</a> 
  • inc/public/default-templates/mustek/post.html

    r3017 r3167  
    100100          </tpl:AttachmentsHeader> 
    101101               <li class="{{tpl:AttachmentType}}"> 
    102                     <tpl:AttachmentIf is_mp3="1"> 
    103                          {{tpl:include src="_mp3_player.html"}} - 
     102                    <tpl:AttachmentIf is_audio="1"> 
     103                         {{tpl:include src="_audio_player.html"}} 
    104104                    </tpl:AttachmentIf> 
    105                     <tpl:AttachmentIf is_flv="1"> 
    106                 {{tpl:include src="_flv_player.html"}} 
    107            </tpl:AttachmentIf> 
    108            <tpl:AttachmentIf is_flv="0"> 
     105                    <tpl:AttachmentIf is_video="1"> 
     106                         <tpl:AttachmentIf is_flv="0"> 
     107                              {{tpl:include src="_video_player.html"}} 
     108                         {{tpl:else}} 
     109                              {{tpl:include src="_flv_player.html"}} 
     110                         </tpl:AttachmentIf> 
     111                    </tpl:AttachmentIf> 
     112           <tpl:AttachmentIf is_audio="0" is_video="0"> 
    109113               <a href="{{tpl:AttachmentURL}}" 
    110114          title="{{tpl:AttachmentFileName}} ({{tpl:AttachmentSize}})">{{tpl:AttachmentTitle}}</a> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map