social 0.12: Smiley-blacklist, re-use timeline image
This commit is contained in:
parent
358e2d8baa
commit
673d61f5e8
|
@ -1,3 +1,7 @@
|
|||
0.12:
|
||||
* Ignore smileys graphics for og:image
|
||||
* Use entry picture from the timeline theme if set
|
||||
|
||||
0.11:
|
||||
* Re-use description set in the metadesc-plugin
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class serendipity_event_social extends serendipity_event {
|
|||
$propbag->add('description', PLUGIN_EVENT_SOCIAL_DESC);
|
||||
$propbag->add('stackable', false);
|
||||
$propbag->add('author', 'onli, Matthias Mees, Thomas Hochstein');
|
||||
$propbag->add('version', '0.11');
|
||||
$propbag->add('version', '0.12');
|
||||
$propbag->add('requirements', array(
|
||||
'serendipity' => '2.0'
|
||||
));
|
||||
|
@ -154,21 +154,28 @@ class serendipity_event_social extends serendipity_event {
|
|||
# /\s+/: multiple newline and whitespaces
|
||||
$meta_description = trim(preg_replace('/\s+/', ' ', substr(strip_tags($entry['body']), 0, 200))) . '...';
|
||||
}
|
||||
$meta_description = serendipity_specialchars($meta_description);
|
||||
echo '<meta property="og:description" content="' . $meta_description . '" />' . "\n";
|
||||
echo '<meta property="og:description" content="' . serendipity_specialchars($meta_description) . '" />' . "\n";
|
||||
echo '<meta property="og:type" content="article" />' . "\n";
|
||||
echo '<meta property="og:site_name" content="' . $serendipity['blogTitle'] . '" />' . "\n";
|
||||
echo '<meta property="og:url" content="'. $blogURL . serendipity_specialchars($_SERVER['REQUEST_URI']) . '" />' . "\n";
|
||||
|
||||
$social_image = $blogURL . $this->get_config('social_image', '');
|
||||
// This is searching for the first image in an entry to use as facebook article image.
|
||||
// A better approach would be to register in the entry editor when an image was added
|
||||
if (preg_match('@<img.*src=["\'](.+)["\']@imsU', $entry['body'] . $entry['extended'], $im)) {
|
||||
if (preg_match('/^http/i', $im[1])) {
|
||||
$social_image = $im[1];
|
||||
} else {
|
||||
$social_image = $blogURL . $im[1];
|
||||
}
|
||||
$social_image = $this->get_config('social_image', '');
|
||||
if (isset($entry['properties']) && isset($entry['properties']['timeline_image'])) {
|
||||
$social_image = $entry['properties']['timeline_image'];
|
||||
} else {
|
||||
// This is searching for the first image in an entry to use as facebook article image.
|
||||
// A better approach would be to register in the entry editor when an image was added
|
||||
if (preg_match_all('@<img.*src=["\'](.+)["\']@imsU', $entry['body'] . $entry['extended'], $images)) {
|
||||
foreach (array_reverse($images[1]) as $im) {
|
||||
if (strpos($im, '/emoticons/') === false) {
|
||||
$social_image = $im;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! preg_match('/^http/i', $social_image)) {
|
||||
$social_image = $blogURL . $social_image;
|
||||
}
|
||||
|
||||
if ($social_image != $blogURL && $social_image != $blogURL . 'none') {
|
||||
|
|
Loading…
Reference in a new issue