SEOPress - Version 3.3.3

Version Description

  • NEW Add og:image:width, og:image:height, og:image:alt and og:image:secure_url for better social sharing
  • FIX Notice $is_block_editor
Download this release

Release Info

Developer rainbowgeek
Plugin Icon 128x128 SEOPress
Version 3.3.3
Comparing to
See all releases

Code changes from version 3.3.2 to 3.3.3

inc/admin/admin-metaboxes.php CHANGED
@@ -179,11 +179,14 @@ function seopress_display_seo_metaboxe() {
179
  wp_enqueue_script( 'seopress-cpt-counters-js', plugins_url( 'assets/js/seopress-counters.js', dirname(dirname( __FILE__ ))), array( 'jquery' ), SEOPRESS_VERSION );
180
 
181
  //If Gutenberg ON
182
- $get_current_screen = get_current_screen();
183
- if ($get_current_screen->is_block_editor == 1) {
184
- wp_enqueue_script( 'seopress-block-editor-js', plugins_url( 'assets/js/seopress-block-editor.js', dirname(dirname( __FILE__ ))), array( 'jquery' ), SEOPRESS_VERSION );
 
 
 
 
185
  }
186
-
187
  wp_enqueue_script( 'seopress-cpt-video-sitemap-js', plugins_url( 'assets/js/seopress-sitemap-video.js', dirname(dirname( __FILE__ ))), array( 'jquery', 'jquery-ui-accordion' ), SEOPRESS_VERSION );
188
 
189
  $seopress_real_preview = array(
179
  wp_enqueue_script( 'seopress-cpt-counters-js', plugins_url( 'assets/js/seopress-counters.js', dirname(dirname( __FILE__ ))), array( 'jquery' ), SEOPRESS_VERSION );
180
 
181
  //If Gutenberg ON
182
+ if (function_exists('get_current_screen')) {
183
+ $get_current_screen = get_current_screen();
184
+ if (isset($get_current_screen->is_block_editor)) {
185
+ if ($get_current_screen->is_block_editor == 1) {
186
+ wp_enqueue_script( 'seopress-block-editor-js', plugins_url( 'assets/js/seopress-block-editor.js', dirname(dirname( __FILE__ ))), array( 'jquery' ), SEOPRESS_VERSION );
187
+ }
188
+ }
189
  }
 
190
  wp_enqueue_script( 'seopress-cpt-video-sitemap-js', plugins_url( 'assets/js/seopress-sitemap-video.js', dirname(dirname( __FILE__ ))), array( 'jquery', 'jquery-ui-accordion' ), SEOPRESS_VERSION );
191
 
192
  $seopress_real_preview = array(
inc/functions/options-social.php CHANGED
@@ -682,29 +682,70 @@ function seopress_thumbnail_in_content() {
682
  }
683
  }
684
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
685
  function seopress_social_fb_img_hook() {
686
  if (seopress_social_facebook_og_option() =='1') {
687
  //Init
688
  $seopress_social_og_thumb ='';
689
 
690
  if (is_home() && seopress_social_fb_img_home_option() !='' && 'page' == get_option( 'show_on_front' )) {
691
- $seopress_social_og_thumb .= '<meta property="og:image" content="'.seopress_social_fb_img_home_option().'" />';
692
- $seopress_social_og_thumb .= "\n";
693
  } elseif (is_singular() && seopress_social_facebook_og_option() =='1' && seopress_social_fb_img_post_option() !='') {
694
- $seopress_social_og_thumb .= '<meta property="og:image" content="'.seopress_social_fb_img_post_option().'" />';
695
- $seopress_social_og_thumb .= "\n";
696
  } elseif (is_singular() && seopress_social_facebook_og_option() =='1' && has_post_thumbnail() ) {
697
- $seopress_social_og_thumb .= '<meta property="og:image" content="'.get_the_post_thumbnail_url().'" />';
698
- $seopress_social_og_thumb .= "\n";
699
  } elseif (is_singular() && seopress_social_facebook_og_option() =='1' && seopress_thumbnail_in_content() !='' ) {
700
- $seopress_social_og_thumb .= '<meta property="og:image" content="'.seopress_thumbnail_in_content().'" />';
701
- $seopress_social_og_thumb .= "\n";
702
  } elseif ((is_tax() || is_category() || is_tag()) && seopress_social_fb_img_term_option() !='') {
703
- $seopress_social_og_thumb .= '<meta property="og:image" content="'.seopress_social_fb_img_term_option().'" />';
704
- $seopress_social_og_thumb .= "\n";
705
  } elseif (seopress_social_facebook_og_option() =='1' && seopress_social_facebook_img_option() !='') {
706
- $seopress_social_og_thumb .= '<meta property="og:image" content="'.seopress_social_facebook_img_option().'" />';
707
- $seopress_social_og_thumb .= "\n";
708
  }
709
 
710
  //Hook on post OG thumbnail - 'seopress_social_og_thumb'
682
  }
683
  }
684
 
685
+ function seopress_social_fb_img_size_from_url($url) {
686
+ if (function_exists('attachment_url_to_postid')) {
687
+ $post_id = attachment_url_to_postid( $url );
688
+ //If cropped image
689
+ if ( !$post_id ){
690
+ $dir = wp_upload_dir();
691
+ $path = $url;
692
+ if ( 0 === strpos( $path, $dir['baseurl'] . '/' ) ) {
693
+ $path = substr( $path, strlen( $dir['baseurl'] . '/' ) );
694
+ }
695
+
696
+ if ( preg_match( '/^(.*)(\-\d*x\d*)(\.\w{1,})/i', $path, $matches ) ){
697
+ $url = $dir['baseurl'] . '/' . $matches[1] . $matches[3];
698
+ $post_id = attachment_url_to_postid( $url );
699
+ }
700
+ }
701
+
702
+ $image_src = wp_get_attachment_image_src( $post_id, 'full' );
703
+
704
+ //OG:IMAGE
705
+ $seopress_social_og_thumb .= '<meta property="og:image" content="'.$url.'" />';
706
+ $seopress_social_og_thumb .= "\n";
707
+
708
+ //OG:IMAGE:SECURE_URL IF SSL
709
+ if (is_ssl()) {
710
+ $seopress_social_og_thumb .= '<meta property="og:image:secure_url" content="'.$url.'" />';
711
+ $seopress_social_og_thumb .= "\n";
712
+ }
713
+
714
+ //OG:IMAGE:WIDTH + OG:IMAGE:HEIGHT
715
+ if (!empty($image_src)) {
716
+ $seopress_social_og_thumb .= '<meta property="og:image:width" content="'.$image_src[1].'" />';
717
+ $seopress_social_og_thumb .= "\n";
718
+ $seopress_social_og_thumb .= '<meta property="og:image:height" content="'.$image_src[2].'" />';
719
+ $seopress_social_og_thumb .= "\n";
720
+ }
721
+
722
+ //OG:IMAGE:ALT
723
+ if (get_post_meta($post_id, '_wp_attachment_image_alt', true) !='') {
724
+ $seopress_social_og_thumb .= '<meta property="og:image:alt" content="'.get_post_meta($post_id, '_wp_attachment_image_alt', true).'" />';
725
+ $seopress_social_og_thumb .= "\n";
726
+ }
727
+
728
+ return $seopress_social_og_thumb;
729
+ }
730
+ }
731
+
732
  function seopress_social_fb_img_hook() {
733
  if (seopress_social_facebook_og_option() =='1') {
734
  //Init
735
  $seopress_social_og_thumb ='';
736
 
737
  if (is_home() && seopress_social_fb_img_home_option() !='' && 'page' == get_option( 'show_on_front' )) {
738
+ $seopress_social_og_thumb .= seopress_social_fb_img_size_from_url(seopress_social_fb_img_home_option());
 
739
  } elseif (is_singular() && seopress_social_facebook_og_option() =='1' && seopress_social_fb_img_post_option() !='') {
740
+ $seopress_social_og_thumb .= seopress_social_fb_img_size_from_url(seopress_social_fb_img_post_option());
 
741
  } elseif (is_singular() && seopress_social_facebook_og_option() =='1' && has_post_thumbnail() ) {
742
+ $seopress_social_og_thumb .= seopress_social_fb_img_size_from_url(get_the_post_thumbnail_url());
 
743
  } elseif (is_singular() && seopress_social_facebook_og_option() =='1' && seopress_thumbnail_in_content() !='' ) {
744
+ $seopress_social_og_thumb .= seopress_social_fb_img_size_from_url(seopress_thumbnail_in_content());
 
745
  } elseif ((is_tax() || is_category() || is_tag()) && seopress_social_fb_img_term_option() !='') {
746
+ $seopress_social_og_thumb .= seopress_social_fb_img_size_from_url(seopress_social_fb_img_term_option());
 
747
  } elseif (seopress_social_facebook_og_option() =='1' && seopress_social_facebook_img_option() !='') {
748
+ $seopress_social_og_thumb .= seopress_social_fb_img_size_from_url(seopress_social_facebook_img_option());
 
749
  }
750
 
751
  //Hook on post OG thumbnail - 'seopress_social_og_thumb'
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: seo, search engine optimization, meta title, open graph, content analysis,
6
  Requires at least: 4.4+
7
  Tested up to: 5.0
8
  Requires PHP: 5.4
9
- Stable tag: 3.3.2
10
  License: GPLv2 or later
11
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -161,6 +161,9 @@ Subscribe on <a href="https://www.seopress.org/" target="_blank">seopress.org</a
161
  44. Structured Data Types metaboxe in post, page, custom post type (PRO)
162
 
163
  == Changelog ==
 
 
 
164
  = 3.3.2 =
165
  * FIX Support non unicode characters and accents in Redirections
166
  = 3.3.1 =
6
  Requires at least: 4.4+
7
  Tested up to: 5.0
8
  Requires PHP: 5.4
9
+ Stable tag: 3.3.3
10
  License: GPLv2 or later
11
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
12
 
161
  44. Structured Data Types metaboxe in post, page, custom post type (PRO)
162
 
163
  == Changelog ==
164
+ = 3.3.3 =
165
+ * NEW Add og:image:width, og:image:height, og:image:alt and og:image:secure_url for better social sharing
166
+ * FIX Notice $is_block_editor
167
  = 3.3.2 =
168
  * FIX Support non unicode characters and accents in Redirections
169
  = 3.3.1 =
seopress.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: SEOPress
4
  Plugin URI: https://www.seopress.org/
5
  Description: The best plugin for SEO.
6
- Version: 3.3.2
7
  Author: Benjamin Denis
8
  Author URI: https://www.seopress.org/
9
  License: GPLv2
@@ -53,7 +53,7 @@ register_deactivation_hook(__FILE__, 'seopress_deactivation');
53
  ///////////////////////////////////////////////////////////////////////////////////////////////////
54
  //Define
55
  ///////////////////////////////////////////////////////////////////////////////////////////////////
56
- define( 'SEOPRESS_VERSION', '3.3.2' );
57
  define( 'SEOPRESS_AUTHOR', 'Benjamin Denis' );
58
 
59
  ///////////////////////////////////////////////////////////////////////////////////////////////////
3
  Plugin Name: SEOPress
4
  Plugin URI: https://www.seopress.org/
5
  Description: The best plugin for SEO.
6
+ Version: 3.3.3
7
  Author: Benjamin Denis
8
  Author URI: https://www.seopress.org/
9
  License: GPLv2
53
  ///////////////////////////////////////////////////////////////////////////////////////////////////
54
  //Define
55
  ///////////////////////////////////////////////////////////////////////////////////////////////////
56
+ define( 'SEOPRESS_VERSION', '3.3.3' );
57
  define( 'SEOPRESS_AUTHOR', 'Benjamin Denis' );
58
 
59
  ///////////////////////////////////////////////////////////////////////////////////////////////////