WordPress.org

Plugin Directory

Changeset 561195


Ignore:
Timestamp:
06/20/12 16:05:51 (22 months ago)
Author:
yoavf
Message:

sharing: ditch the conditional var to decide if the linkedin js has already been outputted. Instead, output it once in the footer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jetpack/trunk/modules/sharedaddy/sharing-sources.php

    r551659 r561195  
    610610     
    611611    public function get_display( $post ) { 
    612         static $added_linkedin_js = false; 
    613         $proto = ( is_ssl() ) ? 'https://' : 'http://'; 
    614612        $permalink = get_permalink( $post->ID ); 
    615         $display = ''; 
    616          
    617         if( $this->smart ) { 
    618              
    619             // So we don't spit out the linkedin js for each post on index pages 
    620             if( ! $added_linkedin_js ) { 
    621                 $display .= sprintf( '<script type="text/javascript" src="%splatform.linkedin.com/in.js"></script>', $proto ); 
    622                 $added_linkedin_js = true; 
    623             } 
    624              
    625             $display .= sprintf( '<div class="linkedin_button"><script type="in/share" data-url="%s" data-counter="right"></script></div>', esc_url( $permalink ) ); 
    626              
    627         } else { 
    628          
     613         
     614        if( $this->smart ) 
     615            $display = sprintf( '<div class="linkedin_button"><script type="in/share" data-url="%s" data-counter="right"></script></div>', esc_url( $permalink ) );          
     616        else         
    629617            $display = $this->get_link( $permalink, _x( 'LinkedIn', 'share to', 'jetpack' ), __( 'Click to share on LinkedIn', 'jetpack' ), 'share=linkedin' ); 
    630618             
    631         } 
    632619        return $display; 
     620    } 
     621 
     622    public function display_footer() { 
     623        if( $this->smart ) 
     624            echo '<script type="text/javascript" src="//platform.linkedin.com/in.js"></script>';  
    633625    } 
    634626     
Note: See TracChangeset for help on using the changeset viewer.