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

Version Description

  • No og:description for password protected and private posts (Thanks for the heads up Benot)
  • Tested with WordPress 5.0.3 and WooCommerce 3.5.3
Download this release

Release Info

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

Code changes from version 2.2.4.2 to 2.2.5

admin/js/webdados-fb-open-graph-admin.js CHANGED
@@ -38,6 +38,18 @@
38
  }
39
  });
40
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  //General
42
  showDescriptionCustomText(false);
43
  showDescriptionDefaultCustomText(false);
38
  }
39
  });
40
 
41
+ //Default or mShot
42
+ $('#fb_image_use_default').on('change', function(event) {
43
+ if ( $(this).is(':checked') ) {
44
+ $('#fb_image_use_mshot').prop('checked', false);
45
+ }
46
+ });
47
+ $('#fb_image_use_mshot').on('change', function(event) {
48
+ if ( $(this).is(':checked') ) {
49
+ $('#fb_image_use_default').prop('checked', false);
50
+ }
51
+ });
52
+
53
  //General
54
  showDescriptionCustomText(false);
55
  showDescriptionDefaultCustomText(false);
admin/options-page-general.php CHANGED
@@ -150,6 +150,14 @@ global $webdados_fb;
150
  5) <input type="checkbox" name="wonderm00n_open_graph_settings[fb_image_use_default]" id="fb_image_use_default" value="1" <?php echo (intval($options['fb_image_use_default'])==1 ? ' checked="checked"' : '' ); ?>/>
151
  <small><?php _e( 'Default image specified above', 'wonderm00ns-simple-facebook-open-graph-tags' );?></small>
152
  </div>
 
 
 
 
 
 
 
 
153
  </td>
154
  </tr>
155
  <tr>
150
  5) <input type="checkbox" name="wonderm00n_open_graph_settings[fb_image_use_default]" id="fb_image_use_default" value="1" <?php echo (intval($options['fb_image_use_default'])==1 ? ' checked="checked"' : '' ); ?>/>
151
  <small><?php _e( 'Default image specified above', 'wonderm00ns-simple-facebook-open-graph-tags' );?></small>
152
  </div>
153
+ <!-- mShots not working on Facebook - Needs more testing -->
154
+ <!-- <div>
155
+ &nbsp; &nbsp; &nbsp;or
156
+ </div>
157
+ <div>
158
+ &nbsp; &nbsp; &nbsp;<input type="checkbox" name="wonderm00n_open_graph_settings[fb_image_use_mshot]" id="fb_image_use_mshot" value="1" <?php echo (intval($options['fb_image_use_mshot'])==1 ? ' checked="checked"' : '' ); ?>/>
159
+ <small><?php _e( 'Page screenshot (provided by WordPress.com mShots API)', 'wonderm00ns-simple-facebook-open-graph-tags' );?></small>
160
+ </div> -->
161
  </td>
162
  </tr>
163
  <tr>
includes/class-webdados-fb-open-graph.php CHANGED
@@ -41,6 +41,7 @@ class Webdados_FB {
41
  'fb_image_use_content' => 0,
42
  'fb_image_use_media' => 0,
43
  'fb_image_use_default' => 1,
 
44
  'fb_adv_disable_image_size' => 0,
45
  //OG
46
  'fb_title_show' => 1,
@@ -138,6 +139,7 @@ class Webdados_FB {
138
  'fb_image_use_content' => 'intval',
139
  'fb_image_use_media' => 'intval',
140
  'fb_image_use_default' => 'intval',
 
141
  'fb_adv_disable_image_size' => 'intval',
142
  'fb_image_min_size' => 'intval',
143
  'fb_show_wpseoyoast' => 'intval',
41
  'fb_image_use_content' => 0,
42
  'fb_image_use_media' => 0,
43
  'fb_image_use_default' => 1,
44
+ 'fb_image_use_mshot' => 0,
45
  'fb_adv_disable_image_size' => 0,
46
  //OG
47
  'fb_title_show' => 1,
139
  'fb_image_use_content' => 'intval',
140
  'fb_image_use_media' => 'intval',
141
  'fb_image_use_default' => 'intval',
142
+ 'fb_image_use_mshot' => 'intval',
143
  'fb_adv_disable_image_size' => 'intval',
144
  'fb_image_min_size' => 'intval',
145
  'fb_show_wpseoyoast' => 'intval',
public/class-webdados-fb-open-graph-public.php CHANGED
@@ -137,12 +137,12 @@ class Webdados_FB_Public {
137
  if ( $fb_desc = trim( get_post_meta($post->ID, '_webdados_fb_open_graph_specific_description', true) ) ) {
138
  //From our metabox
139
  } else {
140
- if ( trim($post->post_excerpt) != '' ) {
141
  //If there's an excerpt that's what we'll use
142
- $fb_desc = trim($post->post_excerpt);
143
  } else {
144
  //If not we grab it from the content
145
- $fb_desc = trim($post->post_content);
146
  }
147
  }
148
  // Image
@@ -269,7 +269,7 @@ class Webdados_FB_Public {
269
  //Other pages - Defaults
270
  $fb_title = wp_strip_all_tags( stripslashes( get_bloginfo( 'name' ) ), true );
271
  $fb_url = ( ( !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ) ? 'https://' : 'http://' ).$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; //Not really canonical but will work for now
272
- $fb_image = trim( $this->options['fb_image'] );
273
 
274
  $this->options['fb_article_sections_show'] = 0;
275
  $this->options['fb_article_dates_show'] = 0;
@@ -498,6 +498,19 @@ class Webdados_FB_Public {
498
 
499
  }
500
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
501
 
502
  //Apply Filters
503
  $fb_app_id = apply_filters('fb_og_app_id', $this->options['fb_app_id']);
137
  if ( $fb_desc = trim( get_post_meta($post->ID, '_webdados_fb_open_graph_specific_description', true) ) ) {
138
  //From our metabox
139
  } else {
140
+ if ( trim( $post->post_excerpt ) != '' ) {
141
  //If there's an excerpt that's what we'll use
142
+ $fb_desc = trim( $post->post_excerpt );
143
  } else {
144
  //If not we grab it from the content
145
+ $fb_desc = trim( $post->post_content );
146
  }
147
  }
148
  // Image
269
  //Other pages - Defaults
270
  $fb_title = wp_strip_all_tags( stripslashes( get_bloginfo( 'name' ) ), true );
271
  $fb_url = ( ( !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ) ? 'https://' : 'http://' ).$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; //Not really canonical but will work for now
272
+ $fb_image = intval($this->options['fb_image_use_default'])==1 ? trim( $this->options['fb_image'] ) : '';
273
 
274
  $this->options['fb_article_sections_show'] = 0;
275
  $this->options['fb_article_dates_show'] = 0;
498
 
499
  }
500
  }
501
+
502
+ //Private post or password protected? (Thanks Benoît)
503
+ if ( is_singular() && ( get_post_status( $post->ID ) == 'private' || ! empty( $post->post_password ) ) ) {
504
+ $fb_desc = '';
505
+ } else {
506
+ //mShot - Only for public posts
507
+ if ( $fb_image == '' && intval($this->options['fb_image_use_mshot'])==1 && ! empty( $fb_url ) ) {
508
+ //No size and no overlay
509
+ $this->options['fb_image_size_show'] = 0;
510
+ $this->options['fb_image_overlay'] = 0;
511
+ $fb_image = 'https://s0.wordpress.com/mshots/v1/'.urlencode($fb_url).'?w=1200&h=630';
512
+ }
513
+ }
514
 
515
  //Apply Filters
516
  $fb_app_id = apply_filters('fb_og_app_id', $this->options['fb_app_id']);
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Open Graph for Facebook, Google+ and Twitter Card Tags ===
2
  Contributors: webdados, wonderm00n
3
  Donate link: http://bit.ly/donate_fb_opengraph
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.5
6
- Tested up to: 5.0-alpha-42610
7
- Stable tag: 2.2.4.2
8
 
9
  Inserts Facebook Open Graph, Google+/Schema.org, Twitter and SEO Meta Tags into your WordPress Website for more efficient sharing results.
10
 
@@ -157,6 +157,10 @@ We DO NOT provide email support for this plugin. If you send us an email asking
157
 
158
  == Changelog ==
159
 
 
 
 
 
160
  = 2.2.4.2 =
161
  * Small security fix
162
 
1
  === Open Graph for Facebook, Google+ and Twitter Card Tags ===
2
  Contributors: webdados, wonderm00n
3
  Donate link: http://bit.ly/donate_fb_opengraph
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, webdados
5
  Requires at least: 4.5
6
+ Tested up to: 5.0.3
7
+ Stable tag: 2.2.5
8
 
9
  Inserts Facebook Open Graph, Google+/Schema.org, Twitter and SEO Meta Tags into your WordPress Website for more efficient sharing results.
10
 
157
 
158
  == Changelog ==
159
 
160
+ = 2.2.5 =
161
+ * No `og:description` for password protected and private posts (Thanks for the heads up Benoît)
162
+ * Tested with WordPress 5.0.3 and WooCommerce 3.5.3
163
+
164
  = 2.2.4.2 =
165
  * Small security fix
166
 
wonderm00n-open-graph.php CHANGED
@@ -3,17 +3,17 @@
3
  Plugin Name: Open Graph for Facebook, Google+ and Twitter Card Tags
4
  Plugin URI: https://www.webdados.pt/produtos-e-servicos/internet/desenvolvimento-wordpress/facebook-open-graph-meta-tags-wordpress/
5
  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.
6
- Version: 2.2.4.2
7
  Author: Webdados
8
  Author URI: https://www.webdados.pt
9
  Text Domain: wonderm00ns-simple-facebook-open-graph-tags
10
  Domain Path: /lang
11
- WC tested up to: 3.3
12
  */
13
 
14
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
15
 
16
- define( 'WEBDADOS_FB_VERSION', '2.2.4.2' );
17
  define( 'WEBDADOS_FB_PLUGIN_NAME', 'Open Graph for Facebook, Google+ and Twitter Card Tags' );
18
  define( 'WEBDADOS_FB_W', 1200 );
19
  define( 'WEBDADOS_FB_H', 630 );
3
  Plugin Name: Open Graph for Facebook, Google+ and Twitter Card Tags
4
  Plugin URI: https://www.webdados.pt/produtos-e-servicos/internet/desenvolvimento-wordpress/facebook-open-graph-meta-tags-wordpress/
5
  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.
6
+ Version: 2.2.5
7
  Author: Webdados
8
  Author URI: https://www.webdados.pt
9
  Text Domain: wonderm00ns-simple-facebook-open-graph-tags
10
  Domain Path: /lang
11
+ WC tested up to: 3.5.3
12
  */
13
 
14
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
15
 
16
+ define( 'WEBDADOS_FB_VERSION', '2.2.5' );
17
  define( 'WEBDADOS_FB_PLUGIN_NAME', 'Open Graph for Facebook, Google+ and Twitter Card Tags' );
18
  define( 'WEBDADOS_FB_W', 1200 );
19
  define( 'WEBDADOS_FB_H', 630 );