JonoM\ShareCare\ShareCare
ShareCare class.
Provide previews for sharing content based on Open Graph tags.
Synopsis
class ShareCare
extends DataExtension
{
- // members
- private static string $twitter_username = '';
- private static bool $twitter_card = true;
- private static bool $pinterest = false;
- private static bool $enable_facebook_cache_clear = true;
- // methods
- public void updateCMSFields()
- public void onAfterPublish()
- public void onAfterWrite()
- public void clearFacebookCache()
- public boolean doClearFacebookCache()
- public string|false FacebookShareLink()
- public string|false TwitterShareLink()
- public string|false PinterestShareLink()
- public string|string LinkedInShareLink()
- public string|false EmailShareLink()
- public string getTwitterMetaTags()
- public void MetaTags()
- public string getDefaultOGTitle()
- public Image|string|false getDefaultOGImage()
Hierarchy
Extends
- SilverStripe\ORM\DataExtension
Uses
- SilverStripe\Core\Config\Configurable
Members
private
- $enable_facebook_cache_clear
—
JonoM\ShareCare\bool
Allow userland config to conditionally permit cache-clearing for Facebook after every page-write. The default is true for BC. - $pinterest
—
JonoM\ShareCare\bool
Whether or not to enable a Pinterest preview and fields. - $twitter_card
—
JonoM\ShareCare\bool
Whether or not to generate a twitter card for this page. - $twitter_username
—
string
Twitter username to be attributed as owner/author of this page.
Methods
public
- MetaTags() — Extension hook for including Twitter Card markup.
- clearFacebookCache() — Tell Facebook to re-scrape this URL, if it is accessible to the public.
- doClearFacebookCache() — Decide wether or not we should be clearing Facebook's cache.
- getDefaultOGImage() — The default/fallback Image object or absolute URL to be used in the 'og:image' open graph tag.
- getDefaultOGTitle() — The default/fallback value to be used in the 'og:title' open graph tag.
- getTwitterMetaTags() — Generate meta tag markup for Twitter Cards Specs: https://dev.twitter.com/cards/types/summary-large-image.
- onAfterPublish() — Ensure public URLs are re-scraped by Facebook after publishing.
- onAfterWrite() — Ensure public URLs are re-scraped by Facebook after writing.
- updateCMSFields() — Add a Social Media tab with a preview of share appearance to the CMS.