pfeifferNet

Share extends Social
in package

Share post to social media.

Allows post or page sharing without needing scripts to be loaded. Uses URL links. Link is shown as an outlined button.

Tags
since
1.0.0
since
6.0.0

Remove sharing functions that are handled by device - Whatsapp, SMS and email.

uses
Link_Buttons

Table of Contents

Constants

CONTAINER_DEFAULTS  = array('aria-label' => '', 'classes' => array('pnet-social-list', 'pnet-social-list-share'))
Default container settings.
FACEBOOK_URL  = 'https://www.facebook.com/sharer/sharer.php'
Facebook sharing url.
LINKEDIN_URL  = 'https://www.linkedin.com/shareArticle'
LinkedIn sharing url.
PINTEREST_URL  = 'https://pinterest.com/pin/create/button/'
Pinterest sharing url.
TWITTER_URL  = 'https://twitter.com/intent/tweet'
Twitter sharing url.

Properties

$container_atts  : array<string|int, mixed>
Social list container attributes.
$icons  : Icons
The instance of the SVG icon handler.
$instances  : array<string|int, object>
The array of instances of this class and sub-classes.
$item_atts  : array<string|int, mixed>
Social list item attributes.
$renderer  : Link_List
The instance of class to render the social links list.
$settings  : array<string|int, mixed>
Site settings.

Methods

get_instance()  : object
Creates and/or returns the instance of this class.
render()  : void
Render the social list of links.
__construct()  : void
Initialise the class.
get_page_thumbnail()  : string
Get page or post thumbnail.
get_page_title()  : string
Get page or post title.
get_page_url()  : string
Get page or post url.
get_twitter_name()  : string
Get page or post author twitter name if it exists.
set_list_container()  : void
Set social list container definitions.
set_list_items()  : void
Set social list item definitions.
set_renderer()  : void
Set the class to render the social list.

Constants

CONTAINER_DEFAULTS

Default container settings.

protected array<string|int, mixed> CONTAINER_DEFAULTS = array('aria-label' => '', 'classes' => array('pnet-social-list', 'pnet-social-list-share'))

CONTAINER_DEFAULTS { Definition of the social menu container. @type string $aria_label The text for the nav element ARIA label. @type string[] $classes The array of classes for the links list container. }

Tags
since
5.5.0
see
Social::CONTAINER_DEFAULTS

FACEBOOK_URL

Facebook sharing url.

protected string FACEBOOK_URL = 'https://www.facebook.com/sharer/sharer.php'
Tags
since
5.3.0

LINKEDIN_URL

LinkedIn sharing url.

protected string LINKEDIN_URL = 'https://www.linkedin.com/shareArticle'
Tags
since
5.3.0

PINTEREST_URL

Pinterest sharing url.

protected string PINTEREST_URL = 'https://pinterest.com/pin/create/button/'
Tags
since
5.3.0

TWITTER_URL

Twitter sharing url.

protected string TWITTER_URL = 'https://twitter.com/intent/tweet'
Tags
since
5.3.0

Properties

$container_atts

Social list container attributes.

protected array<string|int, mixed> $container_atts = array()

{ Social list container attributes. @type string[] $classes The container CSS classes. @type int $author_id The id of the post or page author. }

Tags
since
5.0.0

$icons

The instance of the SVG icon handler.

protected Icons $icons
Tags
since
6.0.0

$instances

The array of instances of this class and sub-classes.

protected static array<string|int, object> $instances = array()
Tags
since
5.11.0

$item_atts

Social list item attributes.

protected array<string|int, mixed> $item_atts = array()

{ Social list item attributes. @type string $service Service name. @type string $text Text to display on the button. @type string $url The URL the button points to. @type string $title The title attribute of the button. $type bool $new_tab Use new tab flag. }

Tags
since
5.0.0

$renderer

The instance of class to render the social links list.

protected Link_List $renderer
Tags
since
6.0.0

$settings

Site settings.

protected array<string|int, mixed> $settings = array()
Tags
since
6.3.0

Methods

get_instance()

Creates and/or returns the instance of this class.

public static get_instance() : object
Tags
since
5.11.0
Return values
object

The instance of this class.

render()

Render the social list of links.

public render([array<string|int, mixed> $args = array() ]) : void
Parameters
$args : array<string|int, mixed> = array()

Array of display attributes.

Tags
since
5.5.0
since
6.0.0

Refactor to allow sub-classes to set rendering class.

__construct()

Initialise the class.

protected __construct() : void

Set the class to render links in the "use" declaration.

Tags
since
5.11.0
since
6.0.0

Change class definition to render links list.

since
6.3.0

Use settings class to get site settings.

uses
Icons
uses
Settings
uses
Settings::get()

get_page_title()

Get page or post title.

protected get_page_title() : string
Tags
since
5.0.0
Return values
string

The current page title.

get_page_url()

Get page or post url.

protected get_page_url() : string
Tags
since
5.0.0
Return values
string

The url of current page.

get_twitter_name()

Get page or post author twitter name if it exists.

protected get_twitter_name([int $author_id = 0 ]) : string
Parameters
$author_id : int = 0

User id of the post author.

Tags
since
1.0.0
Return values
string

set_list_container()

Set social list container definitions.

protected set_list_container(array<string|int, mixed> $args) : void

Override this in subclass to set list container properties.

Parameters
$args : array<string|int, mixed>

Array of display attributes.

Tags
since
6.0.0

set_list_items()

Set social list item definitions.

protected set_list_items() : void
Tags
since
5.5.0
uses
Icons::get_icon()

set_renderer()

Set the class to render the social list.

protected set_renderer() : void
Tags
since
6.0.0
uses
Link_Buttons

        
On this page

Search results