Plugin Directory

Changeset 592497


Ignore:
Timestamp:
08/30/2012 04:28:57 PM (13 years ago)
Author:
niccolo_tapparo
Message:

version 1.1.7 - bugfix

Location:
wordpress-social-ring
Files:
24 added
3 edited

Legend:

Unmodified
Added
Removed
  • wordpress-social-ring/trunk/includes/library.php

    r584582 r592497  
    1616        echo "<meta property=\"og:site_name\" content=\"".esc_attr(get_bloginfo('name'))."\" />\n";
    1717        echo "<meta property=\"og:description\" content=\"".esc_attr(social_ring_make_excerpt($post))."\" />\n";
    18         if ( empty( $image ) && function_exists('has_post_thumbnail') && has_post_thumbnail( $post->ID ) ) {
    19             $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' );
    20             if ( $thumbnail )
    21                 $image = $thumbnail[0];
    22         // If that's not there, grab the first attached image
    23         } else {
    24             $files = get_children(
    25                         array(
    26                         'post_parent' => $post->ID,
    27                         'post_type' => 'attachment',
    28                         'post_mime_type' => 'image',
    29                         )
    30                     );
    31             if ( $files ) {
    32                 $keys = array_reverse( array_keys( $files ) );
    33                 $image = image_downsize( $keys[0], 'thumbnail' );
    34                 $image = $image[0];
    35             //if there's no attached image, try to grab first image in content
    36             } else {
    37                 $image = social_ring_get_first_image();
    38             }
    39         }   
     18        $image = social_ring_get_first_image();
    4019        if ( $image != '' ) {
    4120            echo "<meta property=\"og:image\" content=\"".esc_attr( $image )."\" />\n";
     
    4726
    4827function social_ring_get_first_image() {
    49   global $post, $posts;
    50   $first_img = '';
    51   ob_start();
    52   ob_end_clean();
    53 
    54   $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i',
    55        $post->post_content, $matches);
    56   $first_img = $matches [1] [0];
    57 
    58   return $first_img;
     28 
     29    global $post, $posts;
     30 
     31    if ( function_exists('has_post_thumbnail') && has_post_thumbnail( $post->ID ) ) {
     32       
     33        $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' );
     34        if ( $thumbnail )
     35            $image = $thumbnail[0];
     36           
     37    // If that's not there, grab the first attached image
     38    } else {
     39       
     40        $files = get_children(
     41            array(
     42            'post_parent' => $post->ID,
     43            'post_type' => 'attachment',
     44            'post_mime_type' => 'image',
     45            )
     46        );
     47        if ( $files ) {
     48            $keys = array_reverse( array_keys( $files ) );
     49            $image = image_downsize( $keys[0], 'thumbnail' );
     50            $image = $image[0];
     51        }
     52    }
     53    //if there's no attached image, try to grab first image in content
     54    if(empty($image)) {
     55        ob_start();
     56        ob_end_clean();
     57        $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i',
     58             $post->post_content, $matches);
     59        if(!empty($matches[1][0])) {
     60              $image = $matches[1][0];
     61        }
     62    }
     63
     64    return $image;
    5965}
    6066
  • wordpress-social-ring/trunk/readme.txt

    r584840 r592497  
    55Requires at least: 3.2
    66Tested up to: 3.4
    7 Version: 1.1.7
    8 Stable tag: 1.1.7
     7Version: 1.1.8
     8Stable tag: 1.1.8
    99
    1010WordPress Social Ring adds sharing buttons for Facebook, Twitter and Google+.
     
    3535
    3636== Changelog ==
     37
     38= 1.1.8 =
     39
     40* Bugfix
    3741
    3842= 1.1.7 =
  • wordpress-social-ring/trunk/wp-social-ring.php

    r584582 r592497  
    44Description: Let visitors share posts/pages on Facebook, Twitter and Google+. From admin page you can choose which button display: Facebook Like, Facebook Send, Facebook Share, Google +1 and Twitter.
    55Author: Niccol&ograve; Tapparo
    6 Version: 1.1.7
     6Version: 1.1.8
    77Author URI: http://wordpress.altervista.org/
    88Plugin URI: http://wordpress.altervista.org/en/tag/wordpress-social-ring-en/
Note: See TracChangeset for help on using the changeset viewer.