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

Version Description

  • Fix where servers with allow_url_fopen disabled would not be able to get_image_size for post content or media gallery images
Download this release

Release Info

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

Code changes from version 1.3.2 to 1.3.3

Files changed (2) hide show
  1. readme.txt +4 -1
  2. wonderm00n-open-graph.php +17 -12
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, seo, share, social, meta, twitter card, twitter, schema, google+, g+, google, google plus, image, like, meta, search engine optimization
5
  Requires at least: 3.5
6
  Tested up to: 4.0.1
7
- Stable tag: 1.3.2
8
 
9
  Inserts Facebook Open Graph, Google+/Schema.org, Twitter and other Meta Tags into your WordPress Website for more efficient sharing results.
10
 
@@ -74,6 +74,9 @@ It allows the user to choose which tags are, or not, included and also the defau
74
 
75
  == Changelog ==
76
 
 
 
 
77
  = 1.3.2 =
78
  * Added Google+ Publisher tag
79
  * Fix on some Portuguese translation strings
4
  Tags: facebook, open graph, open graph protocol, seo, share, social, meta, twitter card, twitter, schema, google+, g+, google, google plus, image, like, meta, search engine optimization
5
  Requires at least: 3.5
6
  Tested up to: 4.0.1
7
+ Stable tag: 1.3.3
8
 
9
  Inserts Facebook Open Graph, Google+/Schema.org, Twitter and other Meta Tags into your WordPress Website for more efficient sharing results.
10
 
74
 
75
  == Changelog ==
76
 
77
+ = 1.3.3 =
78
+ * Fix where servers with allow_url_fopen disabled would not be able to get_image_size for post content or media gallery images
79
+
80
  = 1.3.2 =
81
  * Added Google+ Publisher tag
82
  * Fix on some Portuguese translation strings
wonderm00n-open-graph.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /**
3
  * @package Facebook Open Graph, Google+ and Twitter Card Tags
4
- * @version 1.3.2
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 and Twitter Card 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
- Version: 1.3.2
11
  Author: Webdados
12
  Author URI: http://www.webdados.pt
13
  Text Domain: wd-fb-og
@@ -16,7 +16,7 @@ Domain Path: /lang
16
 
17
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
18
 
19
- $wonderm00n_open_graph_plugin_version='1.3.2';
20
  $wonderm00n_open_graph_plugin_name='Facebook Open Graph, Google+ and Twitter Card Tags';
21
  $wonderm00n_open_graph_plugin_settings=array(
22
  'fb_app_id_show',
@@ -82,7 +82,7 @@ function wonderm00n_open_graph_init() {
82
  add_action('plugins_loaded', 'wonderm00n_open_graph_init');
83
 
84
  function wonderm00n_open_graph() {
85
- global $wonderm00n_open_graph_plugin_settings, $wonderm00n_open_graph_plugin_version, $webdados_fb_open_graph_settings;
86
 
87
  //Upgrade
88
  wonderm00n_open_graph_upgrade();
@@ -455,13 +455,17 @@ function wonderm00n_open_graph_post_image($fb_image_use_specific=1,$fb_image_use
455
  $imgreg = '/<img .*src=["\']([^ ^"^\']*)["\']/';
456
  preg_match_all($imgreg, trim($post->post_content), $matches);
457
  if ($matches[1]) {
 
458
  foreach($matches[1] as $image) {
459
  //There's an image on the content
460
  $pos = strpos($image, site_url());
461
  if ($pos === false) {
462
  if (stristr($image, 'http://') || stristr($image, 'https://')) {
463
  //Complete URL - offsite
464
- $imagetemp=$image;
 
 
 
465
  } else {
466
  $imagetemp=site_url().$image;
467
  }
@@ -469,13 +473,14 @@ function wonderm00n_open_graph_post_image($fb_image_use_specific=1,$fb_image_use
469
  //Complete URL - onsite
470
  $imagetemp=$image;
471
  }
472
- $img_size = getimagesize($imagetemp);
473
- if ($img_size[0] >= 200 && $img_size[1] >= 200) {
474
- $fb_image=$imagetemp;
475
- $thumbdone=true;
476
- break;
 
 
477
  }
478
-
479
  }
480
  }
481
  }
@@ -487,7 +492,7 @@ function wonderm00n_open_graph_post_image($fb_image_use_specific=1,$fb_image_use
487
  if ($images) {
488
  foreach($images as $image) {
489
  $imagetemp=wp_get_attachment_url($image->ID, false);
490
- $img_size = getimagesize($imagetemp);
491
  if ($img_size[0] >= 200 && $img_size[1] >= 200) {
492
  $fb_image=$imagetemp;
493
  $thumbdone=true;
1
  <?php
2
  /**
3
  * @package Facebook Open Graph, Google+ and Twitter Card Tags
4
+ * @version 1.3.3
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 and Twitter Card 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
+ Version: 1.3.3
11
  Author: Webdados
12
  Author URI: http://www.webdados.pt
13
  Text Domain: wd-fb-og
16
 
17
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
18
 
19
+ $wonderm00n_open_graph_plugin_version='1.3.3';
20
  $wonderm00n_open_graph_plugin_name='Facebook Open Graph, Google+ and Twitter Card Tags';
21
  $wonderm00n_open_graph_plugin_settings=array(
22
  'fb_app_id_show',
82
  add_action('plugins_loaded', 'wonderm00n_open_graph_init');
83
 
84
  function wonderm00n_open_graph() {
85
+ global $wonderm00n_open_graph_plugin_settings, $wonderm00n_open_graph_plugin_name, $wonderm00n_open_graph_plugin_version, $webdados_fb_open_graph_settings;
86
 
87
  //Upgrade
88
  wonderm00n_open_graph_upgrade();
455
  $imgreg = '/<img .*src=["\']([^ ^"^\']*)["\']/';
456
  preg_match_all($imgreg, trim($post->post_content), $matches);
457
  if ($matches[1]) {
458
+ $imagetemp=false;
459
  foreach($matches[1] as $image) {
460
  //There's an image on the content
461
  $pos = strpos($image, site_url());
462
  if ($pos === false) {
463
  if (stristr($image, 'http://') || stristr($image, 'https://')) {
464
  //Complete URL - offsite
465
+ if (intval(ini_get('allow_url_fopen'))==1) {
466
+ //If it's offsite we can't probably getimagesize'it, so we won't use it
467
+ $imagetemp=$image;
468
+ }
469
  } else {
470
  $imagetemp=site_url().$image;
471
  }
473
  //Complete URL - onsite
474
  $imagetemp=$image;
475
  }
476
+ if ($imagetemp) {
477
+ $img_size = getimagesize(ABSPATH.str_replace(trailingslashit(site_url()), '', $imagetemp));
478
+ if ($img_size[0] >= 200 && $img_size[1] >= 200) {
479
+ $fb_image=$imagetemp;
480
+ $thumbdone=true;
481
+ break;
482
+ }
483
  }
 
484
  }
485
  }
486
  }
492
  if ($images) {
493
  foreach($images as $image) {
494
  $imagetemp=wp_get_attachment_url($image->ID, false);
495
+ $img_size = getimagesize(ABSPATH.str_replace(trailingslashit(site_url()), '', $imagetemp));
496
  if ($img_size[0] >= 200 && $img_size[1] >= 200) {
497
  $fb_image=$imagetemp;
498
  $thumbdone=true;