Open Graph for Facebook, Google+ and Twitter Card Tags - Version 2.0.5

Version Description

  • Calculated image dimensions are now stored in, 1 day valid, transients in order to avoid unnecessary http requests and improve performance (Thanks Piotr Bogdan)
Download this release

Release Info

Developer webdados
Plugin Icon Open Graph for Facebook, Google+ and Twitter Card Tags
Version 2.0.5
Comparing to
See all releases

Code changes from version 2.0.4 to 2.0.5

public/class-webdados-fb-open-graph-public.php CHANGED
@@ -811,6 +811,11 @@ class Webdados_FB_Public {
811
 
812
  /* Get image size */
813
  private function get_open_graph_image_size( $image ) {
 
 
 
 
 
814
  if ( stristr($image, 'http://' ) || stristr($image, 'https://' ) || mb_substr($image, 0, 2)=='//' ) {
815
  if ( function_exists('curl_version' ) && function_exists('imagecreatefromstring' ) ) {
816
  //We'll get just a part of the image to speed things up. From http://stackoverflow.com/questions/4635936/super-fast-getimagesize-in-php
@@ -866,6 +871,9 @@ class Webdados_FB_Public {
866
  //Local path
867
  $img_size = getimagesize($image);
868
  }
 
 
 
869
  $this->image_size = $img_size;
870
  return $img_size;
871
  }
811
 
812
  /* Get image size */
813
  private function get_open_graph_image_size( $image ) {
814
+ $transient_key = 'webdados_og_image_size_' . md5($image);
815
+ $transient_val = get_transient($transient_key);
816
+ if ($transient_val) {
817
+ return $transient_val;
818
+ }
819
  if ( stristr($image, 'http://' ) || stristr($image, 'https://' ) || mb_substr($image, 0, 2)=='//' ) {
820
  if ( function_exists('curl_version' ) && function_exists('imagecreatefromstring' ) ) {
821
  //We'll get just a part of the image to speed things up. From http://stackoverflow.com/questions/4635936/super-fast-getimagesize-in-php
871
  //Local path
872
  $img_size = getimagesize($image);
873
  }
874
+ if ($img_size) {
875
+ set_transient($transient_key, $img_size, DAY_IN_SECONDS);
876
+ }
877
  $this->image_size = $img_size;
878
  return $img_size;
879
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://blog.wonderm00n.com/2011/10/14/wordpress-plugin-simple-faceb
4
  Tags: facebook, open graph, open graph protocol, share, social, meta, rss, twitter card, twitter, schema, google+, g+, google, google plus, image, like, seo, search engine optimization, woocommerce, yoast seo, wordpress seo, woocommerce, subheading, php7
5
  Requires at least: 4.0
6
  Tested up to: 4.6.1
7
- Stable tag: 2.0.4
8
  Inserts Facebook Open Graph, Google+/Schema.org, Twitter and SEO Meta Tags into your WordPress Website for more efficient sharing results.
9
 
10
  == Description ==
@@ -121,6 +121,9 @@ We DO NOT provide email support for this plugin. If you send us an email asking
121
 
122
  == Changelog ==
123
 
 
 
 
124
  = 2.0.4 =
125
  * Non-breaking spaces are converted to normal spaces on the description, because they aren't needed there and this way we can really trim the description
126
 
4
  Tags: facebook, open graph, open graph protocol, share, social, meta, rss, twitter card, twitter, schema, google+, g+, google, google plus, image, like, seo, search engine optimization, woocommerce, yoast seo, wordpress seo, woocommerce, subheading, php7
5
  Requires at least: 4.0
6
  Tested up to: 4.6.1
7
+ Stable tag: 2.0.5
8
  Inserts Facebook Open Graph, Google+/Schema.org, Twitter and SEO Meta Tags into your WordPress Website for more efficient sharing results.
9
 
10
  == Description ==
121
 
122
  == Changelog ==
123
 
124
+ = 2.0.5 =
125
+ * Calculated image dimensions are now stored in, 1 day valid, transients in order to avoid unnecessary http requests and improve performance (Thanks Piotr Bogdan)
126
+
127
  = 2.0.4 =
128
  * Non-breaking spaces are converted to normal spaces on the description, because they aren't needed there and this way we can really trim the description
129
 
wonderm00n-open-graph.php CHANGED
@@ -1,14 +1,14 @@
1
  <?php
2
  /**
3
  * @package Facebook Open Graph, Google+ and Twitter Card Tags
4
- * @version 2.0.4
5
  */
6
  /*
7
  Plugin Name: Facebook Open Graph, Google+ and Twitter Card Tags
8
  Plugin URI: http://www.webdados.pt/produtos-e-servicos/internet/desenvolvimento-wordpress/facebook-open-graph-meta-tags-wordpress/
9
  Description: Inserts Facebook Open Graph, Google+/Schema.org, Twitter Card and SEO Meta Tags into your WordPress Blog/Website for more effective and efficient Facebook, Google+ and Twitter sharing results. You can also choose to insert the "enclosure" and "media:content" tags to the RSS feeds, so that apps like RSS Graffiti and Twitterfeed post the image to Facebook correctly.
10
 
11
- Version: 2.0.4
12
  Author: Webdados
13
  Author URI: http://www.webdados.pt
14
  Text Domain: wd-fb-og
@@ -17,7 +17,7 @@ Domain Path: /lang
17
 
18
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
19
 
20
- define( 'WEBDADOS_FB_VERSION', '2.0.4' );
21
  define( 'WEBDADOS_FB_PLUGIN_NAME', 'Facebook Open Graph, Google+ and Twitter Card Tags' );
22
  define( 'WEBDADOS_FB_W', 1200 );
23
  define( 'WEBDADOS_FB_H', 630 );
1
  <?php
2
  /**
3
  * @package Facebook Open Graph, Google+ and Twitter Card Tags
4
+ * @version 2.0.5
5
  */
6
  /*
7
  Plugin Name: Facebook Open Graph, Google+ and Twitter Card Tags
8
  Plugin URI: http://www.webdados.pt/produtos-e-servicos/internet/desenvolvimento-wordpress/facebook-open-graph-meta-tags-wordpress/
9
  Description: Inserts Facebook Open Graph, Google+/Schema.org, Twitter Card and SEO Meta Tags into your WordPress Blog/Website for more effective and efficient Facebook, Google+ and Twitter sharing results. You can also choose to insert the "enclosure" and "media:content" tags to the RSS feeds, so that apps like RSS Graffiti and Twitterfeed post the image to Facebook correctly.
10
 
11
+ Version: 2.0.5
12
  Author: Webdados
13
  Author URI: http://www.webdados.pt
14
  Text Domain: wd-fb-og
17
 
18
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
19
 
20
+ define( 'WEBDADOS_FB_VERSION', '2.0.5' );
21
  define( 'WEBDADOS_FB_PLUGIN_NAME', 'Facebook Open Graph, Google+ and Twitter Card Tags' );
22
  define( 'WEBDADOS_FB_W', 1200 );
23
  define( 'WEBDADOS_FB_H', 630 );