Page 1 of 1

serendipity_event_social: "og:description" cached somewhere?

Posted: Mon May 15, 2017 10:28 pm
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?!

Re: serendipity_event_social: "og:description" cached somewh

Posted: Tue May 16, 2017 10:55 am
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

Re: serendipity_event_social: "og:description" cached somewh

Posted: Tue May 16, 2017 7:32 pm
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.

Re: serendipity_event_social: "og:description" cached somewh

Posted: Tue May 16, 2017 7:40 pm
by thh
With $entry['properties']['meta_description'] instead of $GLOBALS['entry'][0]['properties']['meta_description'], it works ...

Re: serendipity_event_social: "og:description" cached somewh

Posted: Tue May 16, 2017 7:48 pm
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)?