WordPress.org

Plugin Directory

Changeset 624669


Ignore:
Timestamp:
11/13/12 16:11:20 (5 years ago)
Author:
ecolosites
Message:

EELV share post : v0.1.4

Location:
eelv-share-post/trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • eelv-share-post/trunk/readme.txt

    r624636 r624669  
    3333== Changelog == 
    3434 
     350.1.4 
     36add : icon for extra-link in excerpt 
     37fix : only one thumbnail, if !has_post_thumbnail() 
     38 
    35390.1.3 
    3640fix : performances optimisation 
  • eelv-share-post/trunk/share.css

    r624039 r624669  
    2828    background-repeat:no-repeat; 
    2929} 
     30 
     31.embeelv_blank{ 
     32    display:inline-block; 
     33    width:17px; 
     34    height:15px; 
     35    background:url('img/link.png') no-repeat center center;  
     36} 
     37.embeelv_blank span{ 
     38    display:none;    
     39} 
  • eelv-share-post/trunk/share.php

    r624636 r624669  
    44Plugin URI: http://ecolosites.eelv.fr/eelv-share-post/ 
    55Description: Share a post link from a blog to another blog on the same WP multisite network and include the post content ! 
    6 Version: 0.1.3 
     6Version: 0.1.4 
    77Author: bastho, n4thaniel // EELV 
    88License: CC BY-NC 3.0 
     
    9191      $sharer=false; 
    9292      $tumb=''; 
    93        
     93      $original_thumbnail=has_post_thumbnail(); 
    9494      // INTERNAL LINKS 
    9595      preg_match_all('#<a href="http://(.+)?'.$serv.'/\?p=(\d+)">(.+)?</a>#i',$excerpt,$out, PREG_PATTERN_ORDER);  
    9696      if(is_array($out)){ 
    9797        $sharer=true; 
     98        $thumb_output=false; 
    9899        foreach($out[0] as $id=>$match){ 
    99100          $blogname = str_replace('.','',$out[1][$id]); 
     
    109110            $blog_post = get_blog_post( $blog->blog_id, $postid ); 
    110111          } 
    111           $tumb='<a href="'.$blog_post->guid.'" target="_blank" class="embeelv_blank">&raquo;</a>'; 
    112           if(false !== $image = get_blog_post_thumbnail($blog->blog_id,$blog_post->ID)){ 
    113               $tumb.='<img src="'.$image->guid.'" alt="'.$image->post_name.'"/>'; 
    114             } 
     112          $link='<a href="'.$blog_post->guid.'" target="_blank" class="embeelv_blank"><span>&raquo;</span></a>'; 
     113          if( $original_thumbnail==false && $thumb_output==false){ 
     114              if(false !== $image = get_blog_post_thumbnail($blog->blog_id,$blog_post->ID)){ 
     115                  $tumb.='<img src="'.$image->guid.'" alt="'.$image->post_name.'" class="embeelv_img"/>'; 
     116                  $thumb_output=true; 
     117              } 
     118          } 
    115119        //<h4>&laquo;".$blog_post->post_title."&raquo;</h4> 
    116           $val="<div class='embeelv_excerpt'><p>".substr(strip_tags($blog_post->post_content),0,400)."...</p></div>"; 
     120          $val="<div class='embeelv_excerpt'><p>".substr(strip_tags($blog_post->post_content),0,400)."...".$link."</p></div>"; 
    117121          $excerpt=str_replace($match,$val,$excerpt);  
    118122        } 
     
    123127      if(is_array($out)){ 
    124128        $sharer=true; 
     129        $thumb_output=false; 
    125130        foreach($out[0] as $id=>$match){ 
    126131          $blogname = str_replace('.','',$out[1][$id]); 
     
    137142          } 
    138143          
    139           $tumb='<a href="'.$blog_post->guid.'" target="_blank" class="embeelv_blank">&raquo;</a>'; 
     144          $link='<a href="'.$blog_post->guid.'" target="_blank" class="embeelv_blank"><span>&raquo;</span></a>'; 
     145          if( $original_thumbnail==false && $thumb_output==false){ 
    140146           if(false !== $image = get_blog_post_thumbnail($blog->blog_id,$blog_post->ID)){ 
    141             $tumb.='<img src="'.$image->guid.'" alt="'.$image->post_name.'"/>'; 
     147            $tumb.='<img src="'.$image->guid.'" alt="'.$image->post_name.'" class="embeelv_img"/>'; 
     148            $thumb_output=true; 
    142149           } 
     150          } 
    143151        //<h4>&laquo;".$blog_post->post_title."&raquo;</h4> 
    144           $val="<div class='embeelv_excerpt'>".$tumb."<p>".substr(strip_tags($blog_post->post_content),0,400)."...</p></div>"; 
     152          $val="<div class='embeelv_excerpt'><p>".substr(strip_tags($blog_post->post_content),0,400)."...".$link."</p></div>"; 
    145153          $excerpt=str_replace($match,$val,$excerpt);  
    146154        } 
    147       } 
     155      }  
    148156       
    149157      // YOUTUBE 
     
    186194        //$excerpt.="<a href=\"var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='".$blogurl."/wp-admin/press-this.php',l=d.location,e=encodeURIComponent,u=f+'?u=&t=".$post->post_title."&s=".$post->guid."&v=4';a=function(){if(!w.open(u,'t','toolbar=0,resizable=1,scrollbars=1,status=1,width=720,height=570'));};if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0); else a();void(0)\">#</a>";  
    187195      } 
    188       return $excerpt;     
     196      return $tumb.$excerpt;       
    189197    }  
    190198     
Note: See TracChangeset for help on using the changeset viewer.