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

Version Description

  • Stop showing the metabox or trying to update Facebook cache on non-publicly_queryable post types
Download this release

Release Info

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

Code changes from version 2.1.4.5 to 2.1.5

admin/class-webdados-fb-open-graph-admin.php CHANGED
@@ -69,18 +69,30 @@ class Webdados_FB_Admin {
69
  return $usercontacts;
70
  }
71
 
72
- /* Meta boxes on posts */
73
- public function add_meta_boxes( $usercontacts ) {
74
- global $post;
75
  //All public post types
76
- $public_types = get_post_types( array('public'=>true) );
 
 
 
 
 
77
  //Do not show for some post types
78
  $exclude_types = array(
79
  'attachment',
80
  );
81
  $exclude_types = apply_filters( 'fb_og_metabox_exclude_types', $exclude_types );
 
 
 
 
 
 
 
 
82
  if ( is_object($post) ) {
83
- if ( in_array(get_post_type($post->ID), $public_types) && !in_array(get_post_type($post->ID), $exclude_types) ) {
84
  add_meta_box(
85
  'webdados_fb_open_graph',
86
  WEBDADOS_FB_PLUGIN_NAME,
@@ -344,20 +356,24 @@ class Webdados_FB_Admin {
344
  public function post_updated_messages( $messages ) {
345
  global $post;
346
 
347
- if ( $post && is_array($messages) ) {
348
- if (
349
- ( !isset($_GET['wd_fb_og_status']) )
350
- ||
351
- ( isset($_GET['wd_fb_og_status']) && intval($_GET['wd_fb_og_status'])!=1 )
352
- ) {
353
- foreach ( $messages as $type => $messages1 ) {
354
- $buttons = ' <a class="button button-small" style="margin: 0px 1em;" href="'.esc_url( 'https://developers.facebook.com/tools/debug/sharing/?q='.urlencode(get_permalink($post->ID)) ).'" target="_blank">'.__( 'Manually update Facebook cache', 'wonderm00ns-simple-facebook-open-graph-tags' ).'</a>
355
- <a class="button button-small" style="margin: 0px 1em;" href="'.esc_url( 'https://www.facebook.com/sharer.php?u='.urlencode(get_permalink($post->ID)) ).'" target="_blank">'.__( 'Share this on Facebook', 'wonderm00ns-simple-facebook-open-graph-tags' ).'</a>';
356
- if ( isset($messages1[1]) ) { //Post updated
357
- $messages[$type][1].=$buttons;
358
- }
359
- if ( isset($messages1[6]) ) { //Post published
360
- $messages[$type][6].=$buttons;
 
 
 
 
361
  }
362
  }
363
  }
69
  return $usercontacts;
70
  }
71
 
72
+ /* Get post types */
73
+ public function get_post_types() {
 
74
  //All public post types
75
+ $public_types = get_post_types( array(
76
+ 'public' => true,
77
+ 'publicly_queryable' => true,
78
+ ) );
79
+ //Add page because it's not "publicly_queryable"
80
+ if ( !isset( $public_types['page'] ) ) $public_types['page'] = 'page';
81
  //Do not show for some post types
82
  $exclude_types = array(
83
  'attachment',
84
  );
85
  $exclude_types = apply_filters( 'fb_og_metabox_exclude_types', $exclude_types );
86
+ //Return diff
87
+ return array_diff( $public_types, $exclude_types );
88
+ }
89
+
90
+ /* Meta boxes on posts */
91
+ public function add_meta_boxes( $usercontacts ) {
92
+ global $post;
93
+ $post_types = $this->get_post_types();
94
  if ( is_object($post) ) {
95
+ if ( in_array(get_post_type($post->ID), $post_types) ) {
96
  add_meta_box(
97
  'webdados_fb_open_graph',
98
  WEBDADOS_FB_PLUGIN_NAME,
356
  public function post_updated_messages( $messages ) {
357
  global $post;
358
 
359
+ $post_types = $this->get_post_types();
360
+
361
+ if ( is_object($post) && is_array($messages) ) {
362
+ if ( in_array(get_post_type($post->ID), $post_types) ) {
363
+ if (
364
+ ( !isset($_GET['wd_fb_og_status']) )
365
+ ||
366
+ ( isset($_GET['wd_fb_og_status']) && intval($_GET['wd_fb_og_status'])!=1 )
367
+ ) {
368
+ foreach ( $messages as $type => $messages1 ) {
369
+ $buttons = ' <a class="button button-small" style="margin: 0px 1em;" href="'.esc_url( 'https://developers.facebook.com/tools/debug/sharing/?q='.urlencode(get_permalink($post->ID)) ).'" target="_blank">'.__( 'Manually update Facebook cache', 'wonderm00ns-simple-facebook-open-graph-tags' ).'</a>
370
+ <a class="button button-small" style="margin: 0px 1em;" href="'.esc_url( 'https://www.facebook.com/sharer.php?u='.urlencode(get_permalink($post->ID)) ).'" target="_blank">'.__( 'Share this on Facebook', 'wonderm00ns-simple-facebook-open-graph-tags' ).'</a>';
371
+ if ( isset($messages1[1]) ) { //Post updated
372
+ $messages[$type][1].=$buttons;
373
+ }
374
+ if ( isset($messages1[6]) ) { //Post published
375
+ $messages[$type][6].=$buttons;
376
+ }
377
  }
378
  }
379
  }
includes/class-webdados-fb-open-graph.php CHANGED
@@ -352,6 +352,7 @@ class Webdados_FB {
352
  'mr' => 'mr_IN',
353
  'nl_NL_formal' => 'nl_NL',
354
  'ps' => 'ps_AF',
 
355
  'sah' => 'ky_KG',
356
  'sq' => 'sq_AL',
357
  'te' => 'te_IN',
352
  'mr' => 'mr_IN',
353
  'nl_NL_formal' => 'nl_NL',
354
  'ps' => 'ps_AF',
355
+ 'pt_PT_ao90' => 'pt_PT',
356
  'sah' => 'ky_KG',
357
  'sq' => 'sq_AL',
358
  'te' => 'te_IN',
public/class-webdados-fb-open-graph-public.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * @package Facebook Open Graph, Google+ and Twitter Card Tags
4
- * @version 2.1.4.5
5
  */
6
 
7
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
1
  <?php
2
  /**
3
  * @package Facebook Open Graph, Google+ and Twitter Card Tags
4
+ * @version 2.1.5
5
  */
6
 
7
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://blog.wonderm00n.com/2011/10/14/wordpress-plugin-simple-face
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: 4.9
7
- Stable tag: 2.1.4.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 ==
@@ -142,6 +142,9 @@ We DO NOT provide email support for this plugin. If you send us an email asking
142
 
143
  == Changelog ==
144
 
 
 
 
145
  = 2.1.4.5 =
146
  * Set `CURLOPT_FOLLOWLOCATION` to `true` when trying to get image size via curl and avoid fatal errors (white screen of death) when the response returns 301 or 302 - Thanks [@neonkowy](https://wordpress.org/support/users/neonkowy/)
147
 
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: 4.9
7
+ Stable tag: 2.1.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 ==
142
 
143
  == Changelog ==
144
 
145
+ = 2.1.5 =
146
+ * Stop showing the metabox or trying to update Facebook cache on non-publicly_queryable post types
147
+
148
  = 2.1.4.5 =
149
  * Set `CURLOPT_FOLLOWLOCATION` to `true` when trying to get image size via curl and avoid fatal errors (white screen of death) when the response returns 301 or 302 - Thanks [@neonkowy](https://wordpress.org/support/users/neonkowy/)
150
 
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.1.4.5
5
  */
6
  /*
7
  Plugin Name: Facebook Open Graph, Google+ and Twitter Card Tags
8
  Plugin URI: https://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.1.4.5
12
  Author: Webdados
13
  Author URI: https://www.webdados.pt
14
  Text Domain: wonderm00ns-simple-facebook-open-graph-tags
@@ -18,7 +18,7 @@ WC tested up to: 3.2
18
 
19
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
20
 
21
- define( 'WEBDADOS_FB_VERSION', '2.1.4.5' );
22
  define( 'WEBDADOS_FB_PLUGIN_NAME', 'Facebook Open Graph, Google+ and Twitter Card Tags' );
23
  define( 'WEBDADOS_FB_W', 1200 );
24
  define( 'WEBDADOS_FB_H', 630 );
1
  <?php
2
  /**
3
  * @package Facebook Open Graph, Google+ and Twitter Card Tags
4
+ * @version 2.1.5
5
  */
6
  /*
7
  Plugin Name: Facebook Open Graph, Google+ and Twitter Card Tags
8
  Plugin URI: https://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.1.5
12
  Author: Webdados
13
  Author URI: https://www.webdados.pt
14
  Text Domain: wonderm00ns-simple-facebook-open-graph-tags
18
 
19
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
20
 
21
+ define( 'WEBDADOS_FB_VERSION', '2.1.5' );
22
  define( 'WEBDADOS_FB_PLUGIN_NAME', 'Facebook Open Graph, Google+ and Twitter Card Tags' );
23
  define( 'WEBDADOS_FB_W', 1200 );
24
  define( 'WEBDADOS_FB_H', 630 );