PHP 8.0 no longer allows to call non-static class methods with the static call operator (::). Both the methods NY_OG_Main_Admin::option
and NY_OG_Main_Admin::set_options
are only called statically in the source code, they should therefore both be marked with the keyword “static”. Or error similar to this will happen:
PHP message: PHP Fatal error: Uncaught Error: Non-static method NY_OG_Main_Admin::option() cannot be called statically in /var/www/foobar/wp-content/plugins/wp-open-graph/output.class.php:29
Stack trace:
#0 /var/www/foobar/wp-includes/class-wp-hook.php(287): NY_OG_Output->add_og_elements()
#1 /var/www/foobar/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters()
#2 /var/www/foobar/wp-includes/plugin.php(478): WP_Hook->do_action()
#3 /var/www/foobar/wp-includes/general-template.php(3009): do_action()
#4 /var/www/foobar/wp-content/themes/sometheme/header.php(29): wp_head()
#5 /var/www/foobar/wp-includes/template.php(730): require_once('...')
#6 /var/www/foobar/wp-includes/template.php(676): load_template()
#7 /var/www/foobar/wp-includes/general-template.php(48): locate_template()
#8 /var/www/foobar/wp-content/themes/sometheme/404.php(10): get_header()
#9 /var/www/foobar/wp-includes/template-loader.php(106): include('...')
#10 /var/www/foobar/wp-blog-header.php(19): require_once('...')
I’ve created a patch for the plugin that seems to work:
From 45947335e076553d3c459577573f1f110bb090e3 Mon Sep 17 00:00:00 2001
From: Koala Yeung <[email protected]>
Date: Mon, 21 Jun 2021 12:13:23 +0800
Subject: [PATCH] Fix static function signatures for PHP 8.0
* Statically called functions should have the "static" keyword.
---
main.admin.class.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/main.admin.class.php b/main.admin.class.php
index 64b2b31..fcc0011 100644
--- a/main.admin.class.php
+++ b/main.admin.class.php
@@ -29,11 +29,11 @@ class NY_OG_Main_Admin {
add_action( 'admin_menu', array( __CLASS__, 'wpog_add_pages' ) );
}
- public function option( $name ) {
+ static public function option( $name ) {
return isset( self::$options[$name] ) ? sanitize_text_field( self::$options[$name] ) : null;
}
- public function set_options( $options ) {
+ static public function set_options( $options ) {
self::$options = array_merge( self::$options, $options );
update_option( 'wpog_options', self::$options );
--
2.17.1
]]>
If WP Open Graph is running on a page with no featured image set, the following warning is issued:
Warning: getimagesize(): Filename cannot be empty in … output.class.php on line 306
I fixed it on my website by replacing content on line 306 with:
if ($image_path)
$size = getimagesize( $image_path );
else
$size = 0;
Please fix this in the next update so that my patch won’t be overwritten in the following update.
]]>using php 7.4 getting lots of notices. Please provide a fix. This is a useful plugin I don’t want to disable it.
]]>Hi!
Your Plugin is super nice!
It would be awesome if we could simply add wanted “Custom og:image” pr page as we can today with for og:title and og:description.
Sometimes the picture used in the Page itself needs to be optimized for this purpose, therefore it would be nice to have this feature.
As an example how this could be while editing post/page:
https://pasteboard.co/JexzTi6.png
Thanks!
Best Regards
Horgster
Hi!
First of all, great and simple plugin!
I have added our Basic image and it has been rolled out.
I noticed that some of our pages where it has not been registered as it seems that there has been an og:image registration there before I installed WP Plug. The plugin has not overwritten the existing settings not coming form this plugin.
Here it works:
https://www.oslokiteklubb.no
Here it don’t work
https://www.oslokiteklubb.no/?page_id=3160
The correct image should have been:
https://www.oslokiteklubb.no/wp-content/uploads/2020/06/OKK-Facebook-Preview-Link-Share-Image-1200×628-1.png
It would be nice, than when editing pages, that we could add the local thumbnail image
for that page that we want to have. If removing that image, the page shall default to sitewide image.
Please help!
Thanks for your kind assitance!
Best Regards
Horgster
After installing WP Open Graph, I add the URLS for my images and hit submit. Then I get this error:
403
Forbidden
Access to this resource on the server is denied!
No idea what is happening with it. Any help is appreciated.
]]>I don’t get any of the following tags inserted for posts. It does, however, insert it for the main page. Or rather, they are empty on the other pages/posts.
<meta property=”og:locale” content=”en_us” />
<meta property=”og:type” content=”article” />
<meta property=”og:image:width” content=”” />
<meta property=”og:image:height” content=”” />
<meta property=”og:image” content=”” />
My site has the following structure for posts: /YYYY/MM/DD/this-is-the-title-of-the-post/
It seems to work if I specify a default image URL for all three configuration fields. But I’m somewhat confused as to why it wouldn’t tell me that this is required ??
]]>What if I want to display Open Graph cards from other sites on MY WordPress site?
I want to blog and include a URL and have an Open Graph card display in my blog post.
I already know how to share to facebook and have Open Graph cards show up there…
]]>Dear Open Graph team,
After reviewing all the comments here I can see the theme is the same, anytime there is an update there seems to be PHP errors.
Our site is the same, we have been going back and forth with the server provider for 3 days now but they cant find a solution. They said the only way to solve this issue is to reach out to you. Judging by the lack of responses on other questions for the same issue I’m not sure that this will ever be resolved but here is the error anyway:
: getimagesize (): Filename cannot be empty in /xxx/xxxxxx/xxxxxx/wp-content/plugins/wp-open-graph/output.class.php on line 306
I will wait for a few more days, if this is not possible to resolve we will have to, unfortunately, find a replacement plugin. Please do let me know if you can assist,
-R
]]>Hi there
We’re seeing large log files being caused by the repeated listing of the following error:
[17-Jul-2019 21:40:02 UTC] PHP Warning: getimagesize(https://www.globalrailwayreview.com/wp-content/uploads/Network-Rail-Logo.gif): failed to open stream: no suitable wrapper could be found in /home/grr/public_html/wp-content/plugins/wp-open-graph/output.class.php on line 306
It look as if Wp Open Graph is the culprit, how do I prevent this from happening?
]]>Shows this error on admin pages.
Deprecated: Non-static method NY_OG_Main_Admin::option() should not be called statically in wp-open-graph/output.class.php on line 159
Deprecated: Non-static method NY_OG_Main_Admin::option() should not be called statically in wp-open-graph/output.class.php on line 29
Deprecated: Non-static method NY_OG_Main_Admin::option() should not be called statically in wp-open-graph/output.class.php on line 48
Deprecated: Non-static method NY_OG_Main_Admin::option() should not be called statically in wp-open-graph/output.class.php on line 50
Deprecated: Non-static method NY_OG_Main_Admin::option() should not be called statically in wp-open-graph/output.class.php on line 202
Deprecated: Non-static method NY_OG_Main_Admin::option() should not be called statically in wp-open-graph/output.class.php on line 204
Deprecated: Non-static method NY_OG_Main_Admin::option() should not be called statically in wp-open-graph/output.class.php on line 127
Deprecated: Non-static method NY_OG_Main_Admin::option() should not be called statically in wp-open-graph/output.class.php on line 132
]]>On a host with allow_url_fopen=0
I get a lot of warnings on getimagesize() call in output.class.php, so I’ve added a method in class NY_OG_Output like this:
/**
* Retrieve remote image dimensions
* - getimagesize alternative
*/
/**
* Get Image Size
*
* @param string $url
* @param string $referer
* @return array
*/
public function getimagesize_curl( $url, $referer = '' ) {
// Set headers
$headers = array( 'Range: bytes=0-131072' );
if ( !empty( $referer ) ) { array_push( $headers, 'Referer: ' . $referer ); }
// Get remote image
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
$data = curl_exec( $ch );
$http_status = curl_getinfo( $ch, CURLINFO_HTTP_CODE );
$curl_errno = curl_errno( $ch );
curl_close( $ch );
// Get network stauts
if ( $http_status != 200 ) {
//echo 'HTTP Status[' . $http_status . '] Errno [' . $curl_errno . ']';
return array(0,0);
}
// Process image
$image = imagecreatefromstring( $data );
$dims = [ imagesx( $image ), imagesy( $image ) ];
imagedestroy($image);
return $dims;
}
and changed line 308 from this
$size = @getimagesize( $image_path );
to this
if( ini_get('allow_url_fopen') ) {
$size = getimagesize( $image_path );
}else{
$size = $this->getimagesize_curl( $image_path );
}
Hope you can consider to add something similar ia future release.
Thanks
Hi;
I just tried this out briefly, but it throws errors on PHP 7.0 due to calling non-static methods statically:
Deprecated: Non-static method NY_OG_Main_Admin::wpog_add_pages() should not be called statically in /webroot/wp-includes/plugin.php on line 524
It’d be great to see this fixed in a future release
]]>I wanted to show meta title, meta description and image when someone just type in “www.allinvpn.com” in their facebook status box.
I have used “WP Open Graph” plugin and configured everything, but for some reason when I type in “www.allinvpn.com” in my facebook status post, it is showing incorrect data. Although those data belongs to my site only but I don’t know from where it is coming. Actually that is not I wanted to show, instead I want to show the title, description and image which I setup through “WP Open Graph” plugin.
Could any one please help me out about what should be the issue? Anything that I did wrong?
Thanks.
]]>Hey,
is there a way to use the URLs created by Better Yourls or any other Yourls WordPress plugin to share on Open Graph?
]]>It’s a nice plugin to combine with the “simple share buttons plugin” to make sure the og:images are used correctly.
But this morning I got this error when I did an object debugger at https://developers.facebook.com/tools/debug/og/object/
It says:
Errors That Must Be Fixed:
Object at URL ‘https://www.offshore-rigjobs.com/drilling-positions/floorhand-roughneck-derrickman-positions/’ of type ‘article’ is invalid because the given value ‘en’ for property ‘og:locale:locale’ could not be parsed as type ‘enum’.
Does anyone know the trick to fix this?
Thanks a million.
]]>Hi. Thank you so much for your plugin, it worked great for my website, with the exception of property=”og:url” being wrongly set. It provided a redirect error on facebook. For those of us who have a wordpress install in another directory other than website root directory this plugin will fail to provide the correct information. It would be great if we could change og:url with the plugin. I had to edit the plugin to achieve this, replacing site_url() with home_url() .
Thanks for your work and support!
Hello,
I have “Women’s Fiction” in my description settings. But on Facebook, it is showing: “Women\’s Fiction”.
Any way to fix the apostrophe?
Thanks.
]]>Hi, I have website in two languages (using mqtranslate plugin), but I would love to have appropriate OpenGraph info for sharing – if somebody shares link in English, I would love to have text in English and vice versa.
]]>Hi,
For some reason this plugin stopped working. Facebook can no longer pickup the title, description and featured image of the post. Any idea why? My website is atchuup.com
You can try the facebook sharer of any of the posts to replicate the issue.
Thanks.
]]>Hi
I’ve recently added your plugin to my website, https://blueant.in.
Since then, when I share links on fb, relevant images and associated text shows up.
However, when I share the homepage’s link, no image shows up. I’ve used the ‘inspect element’ option in chrome on the homepage (sorry for being a noob), and I can see that the relevant and correct open graph tag information is present on the page.
But the facebook object debugger is just not able to find it.
What am I doing wrong?
Please help ??
]]>Here’s the thing, when I Like a post on my website my activity history on Facebook says:
‘Pulseframe’ likes an article on the app ‘MyAppName’
and then in front of it was supposed to show a very small thumbnail and the title linking to the post, but it’s only showing the title, the image does not appear at all.
But in some posts it shows the image but doesn’t show the ‘MyAppName’ reference…
]]>My images aren’t being pulled into facebook or google +. When I use the debugger, it says there is a 302 redirect to my post URL with a random series of letters after the date and before the post title. What is going on? I don’t want google to ding me for redirects! Help!
]]>Looks like the _save_postdata call overwrites the values being imported from the xml file.
I fixed locally by adding this check to the _save_postdata call:
public function _save_postdata( $post_id ){
if( !isset($_POST['ny_og_title']) )
{
return $post_id;
}
Should verify that the update code only runs on a form post.
]]>when I activate WP open graph on my site, it causes the “addthis” social share buttons to disappear! When I deactivate WP open graph they come back!
Is there a solution to this?
Don’t see very many replies to the support questions. Hope this is still supported!
Thanks!
Hello Nick!
Great plugin you got there, client is really happy he can see his thumbnails and so on on his facebook posts!
I noticed something though, and not sure where this is coming from, but it only works on new posts. All of the old posts are not affected by your plugin, even though we fill in the details required.
Any way this can be fixed? We are looking to automate the posting of his posts on facebook and most are old :-/
Your help is greatly appreciated.
Best Regards,
Paul
]]>After much troubleshooting have learned that there is a conflict in WP 4.0 with this plugin which causes the Visual Editor to stop working. Text in both visual and text editor turns white and you lose the editor buttons.
Disabled the plugin for now.
]]>Hello,
I installed your great plugin.
But I have an issue because your plugin use original size of featured image, and so it is too big for Facebook.
On debug tool, I get :
“og:image could not be downloaded or is too small”
Well, it isn’t too small but too big.
How can I fix it?
]]>Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method NY_OG_Main_Admin::wpog_add_pages() should not be called statically in /home/shgjas/public_html/shg.consulting/wp-includes/plugin.php on line 470
]]>Hi there!
First of all sorry for my bad english.
I installed the plugin and it’s working fine for me. But there’s a thing what i don’t know how to disable. When I only share my site URL on facebook (juketoon.com) it shows the latest posts picture instead of the default thumbnail of the site. Any idea how can i set up a default image for the main URL?
Thanks for your answer in advance.