serendipity_event_social: "og:description" cached somewhere?

Creating and modifying plugins.
Post Reply
thh
Regular
Posts: 419
Joined: Thu Oct 26, 2006 2:38 pm
Location: Stuttgart, Germany
Contact:

serendipity_event_social: "og:description" cached somewhere?

Post by thh »

I'm using serendipity_event_social and serendipity_event_metadesc.

serendipity_event_social will set og:description according to the meta_description set by serendipity_event_metadesc, if there is any; otherwise it will take the first 200 chars from the entry's body.

What I did

I set the meta_description in serendipity_event_metadesc after publishing (because I forgot to set it, or it was "lost", but that's another bug to chase on another day).

What I expected to happen

<meta name="description"> and <meta property="og:description"> will have the new content.

What really happened

<meta name="description"> got the new content, but <meta property="og:description"> still has the first 200 chars of the posting.

Both entries differ.

What can be the reason for that?!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: serendipity_event_social: "og:description" cached somewh

Post by garvinhicking »

Hey,

hm, the social plugin takes its content from:

Code: Select all

 $meta_description = strip_tags($GLOBALS['entry'][0]['properties']['meta_description']);
so that should refer to the current entry's properties. I don't know if the new caching mechanism maybe interfers, can you try a print_r($GLOBALS['entry'][0]) at that point to see what data it holds? Sounds as if the properties array would be empty?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
thh
Regular
Posts: 419
Joined: Thu Oct 26, 2006 2:38 pm
Location: Stuttgart, Germany
Contact:

Re: serendipity_event_social: "og:description" cached somewh

Post by thh »

garvinhicking wrote:hm, the social plugin takes its content from:

Code: Select all

 $meta_description = strip_tags($GLOBALS['entry'][0]['properties']['meta_description']);
Yep.
garvinhicking wrote:I don't know if the new caching mechanism maybe interfers,
I don't have that activated, as it breaks with serendipity_event_markdown and my (old) PHP version. :)
garvinhicking wrote:can you try a print_r($GLOBALS['entry'][0]) at that point to see what data it holds? Sounds as if the properties array would be empty?
That's very interesting. $GLOBALS['entry'][0] contains only $GLOBALS['entry'][0][plaintext_body], nothing else at all.
thh
Regular
Posts: 419
Joined: Thu Oct 26, 2006 2:38 pm
Location: Stuttgart, Germany
Contact:

Re: serendipity_event_social: "og:description" cached somewh

Post by thh »

With $entry['properties']['meta_description'] instead of $GLOBALS['entry'][0]['properties']['meta_description'], it works ...
thh
Regular
Posts: 419
Joined: Thu Oct 26, 2006 2:38 pm
Location: Stuttgart, Germany
Contact:

Re: serendipity_event_social: "og:description" cached somewh

Post by thh »

We (you :)) seem to have removed most instances of $GLOBALS['entry'][0], see https://github.com/s9y/additional_plugi ... 0c43984a18 or https://github.com/s9y/additional_plugi ... 7b79aed05f, but not all.

Here in serendipity_event_social, it should be replaced by $entry (that is taken from the Smarty object, see viewtopic.php?f=10&t=20853#p10445979 - and, onli, you got that idea from the metadesc-Plugin and some other places, I think, where Garvin merged a patch from Ian, see links above). See PR #55.

We have some other instances of $GLOBALS['entry'][0] in serendipity_event_geotag, serendipity_event_sidebarhider and serendipity_event_markdown. This array seems to be empty in 2.1, but obviously has been filled sometime before.

serendipity_event_markdown sets $GLOBALS['entry'][0]['plaintext_body'], for the metadesc plugin, see viewtopic.php?f=11&t=18351 - but the new metadesc plugin doesn't check it any longer, as it uses $entry from the Smarty object, which does not have ['plaintext_body'] set.

Can somebody explain how the $GLOBALS['entry'][0] array has been working before (and why it doesn't any longer)?
Post Reply