WordPress.org

Plugin Directory

Changeset 535255


Ignore:
Timestamp:
04/24/12 00:39:29 (2 years ago)
Author:
andrewryno
Message:

Version 2.0.1

Location:
wp-facebook-open-graph-protocol/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-facebook-open-graph-protocol/trunk/readme.txt

    r534239 r535255  
    44Tags: open graph, ogp, facebook open graph, google +1, +1, google plus one, plus one, linkedin share, facebook meta, open graph meta, facebook share, facebook like, linkedin 
    55Requires at least: 3.0 
    6 Tested up to: 3.3.1 
    7 Stable tag: trunk 
     6Tested up to: 3.3.2 
     7Stable tag: 2.0.1 
    88 
    99Adds proper Facebook Open Graph Meta tags and values to your site so when links are shared it looks awesome! 
     
    4949 
    5050== Upgrade Notice == 
     51= 2.0.1 = 
     52Bug fixes for HTTPS/SSL pages, SEO plugins, force fallback images and more. 
     53 
    5154= 2.0 = 
    5255BIG Update - now works with ALL SEO plugins for titles and descriptions, adds multiple images and other fixes! 
     
    5962 
    6063== Changelog == 
     64= 2.0.1 = 
     65* Fixed bug where og:url was returning a https URL instead of http, causing Facebook Linter to fail. Now using the WordPress function is_ssl() instead of the $_SERVER global variable. 
     66* Fixed bug with some SEO plugins where the page title and meta description were not being pulled correctly. 
     67* Changed front pages to have the og:type 'website', not 'article'. 
     68* Fixed bug where the 'force fallback' checkbox will check itself after initial installation. 
     69 
    6170= 2.0 = 
    6271* Now works with ALL SEO plugins AND Frameworks like Genesis and Thesis. It now grabs the actual outputted <title> tag and <meta> description after all SEO plugins/themes/etc have done their job. 
  • wp-facebook-open-graph-protocol/trunk/wp-facebook-ogp.php

    r534239 r535255  
    44Plugin URI: http://wordpress.org/extend/plugins/wp-facebook-open-graph-protocol/ 
    55Description: Adds proper Facebook Open Graph Meta tags and values to your site so when links are shared it looks awesome! Works on Google + and Linkedin too! 
    6 Version: 2.0 
     6Version: 2.0.1 
    77Author: Chuck Reynolds 
    88Author URI: http://chuckreynolds.us 
     
    2626*/ 
    2727 
    28 define('WPFBOGP_VERSION', '2.0'); 
     28define('WPFBOGP_VERSION', '2.0.1'); 
    2929wpfbogp_admin_warnings(); 
    3030 
     
    6161} 
    6262 
    63 function start_output_buffer() { 
     63function wpfbogp_start_ob() { 
    6464    // Start the buffer before any output 
    65     ob_start(); 
    66 } 
    67  
    68 function flush_buffer() { 
    69     // Get the entire page HTML output and grab the page title and meta description 
    70     $content = ob_get_contents(); 
     65    ob_start( 'wpfbogp_callback' ); 
     66} 
     67 
     68function wpfbogp_callback( $content ) { 
     69    // Grab the page title and meta description 
    7170    $title = preg_match( '/<title>(.*)<\/title>/', $content, $title_matches ); 
    72      
    7371    $decsription = preg_match( '/<meta name="description" content="(.*)"/', $content, $description_matches ); 
    7472     
    7573    // Take page title and meta description and place it in the ogp meta tags 
    76     if ( $title !== FALSE ) { 
     74    if ( $title !== FALSE && count( $title_matches ) == 2 ) { 
    7775        $content = preg_replace( '/<meta property="og:title" content="(.*)">/', '<meta property="og:title" content="' . $title_matches[1] . '">', $content ); 
    7876    } 
    79     if ( $description !== FALSE ) { 
     77     
     78    if ( $description !== FALSE && count( $description_matches ) == 2 ) { 
    8079        $content = preg_replace( '/<meta property="og:description" content="(.*)">/', '<meta property="og:description" content="' . $description_matches[1] . '">', $content ); 
    8180    } 
    8281     
    83     // End output buffer and echo content 
    84     ob_end_clean(); 
    85      
    86     echo $content; 
    87 } 
    88  
    89 add_action( 'get_header', 'start_output_buffer' ); 
    90 add_action( 'wp_footer', 'flush_buffer', 15 ); // Fire after other plugins (which default to priority 10) 
     82    return $content; 
     83} 
     84 
     85function wpfbogp_flush_ob() { 
     86    ob_end_flush(); 
     87} 
     88 
     89add_action( 'init', 'wpfbogp_start_ob', 0 ); 
     90add_action( 'wp_footer', 'wpfbogp_end_ob', 10000 ); // Fire after other plugins (which default to priority 10) 
    9191 
    9292// build ogp meta 
     
    112112            $wpfbogp_url = get_bloginfo( 'url' ); 
    113113        } else { 
    114             $wpfbogp_url = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . "://".$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 
     114            $wpfbogp_url = 'http' . (is_ssl() ? 's' : '') . "://".$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 
    115115        } 
    116116        echo '<meta property="og:url" content="' . esc_url( apply_filters( 'wpfbogp_url', $wpfbogp_url ) ) . '">' . "\n"; 
     
    140140         
    141141        // do ogp type 
    142         if ( is_singular() ) { 
     142        if ( is_single() ) { 
    143143            $wpfbogp_type = 'article'; 
    144144        } else { 
     
    269269            <tr valign="top"> 
    270270                <th scope="row"><?php _e('Force Fallback Image as Default') ?></th> 
    271                 <td><input type="checkbox" name="wpfbogp[wpfbogp_force_fallback]" value="" <?php if ($options['wpfbogp_force_fallback'] == 1) echo 'checked="checked"'; ?>) /> <?php _e('Use this if you want to use the Default Image for everything instead of looking for featured/content images.') ?></label></td> 
     271                <td><input type="checkbox" name="wpfbogp[wpfbogp_force_fallback]" value="1" <?php if ($options['wpfbogp_force_fallback'] == 1) echo 'checked="checked"'; ?>) /> <?php _e('Use this if you want to use the Default Image for everything instead of looking for featured/content images.') ?></label></td> 
    272272            </tr> 
    273273        </table> 
     
    291291    $input['wpfbogp_app_id'] = wp_filter_nohtml_kses($input['wpfbogp_app_id']); 
    292292    $input['wpfbogp_fallback_img'] = wp_filter_nohtml_kses($input['wpfbogp_fallback_img']); 
    293     $input['wpfbogp_force_fallback'] = isset($input['wpfbogp_force_fallback']) ? 1 : 0; 
     293    $input['wpfbogp_force_fallback'] = ($input['wpfbogp_force_fallback'] == 1) ? 1 : 0; 
    294294    return $input; 
    295295} 
Note: See TracChangeset for help on using the changeset viewer.