PHP Class Twitter\WordPress\Shortcodes\Share

Since: 1.0.0
Inheritance: implements Twitter\WordPress\Shortcodes\ShortcodeInterface
Exibir arquivo Open project: twitter/wordpress Class Usage Examples

Public Properties

Property Type Description
$SHORTCODE_DEFAULTS Accepted shortcode attributes and their default values

Public Methods

Method Description
getPostMeta ( ) : array Get any Tweet values stored for an individual post
init ( ) : void Attach handlers for Tweet button
sanitizeShortcodeParameters ( array $attributes = [] ) : array Convert shortcode parameters, attributes, and defaults into a clean set of Tweet parameters
shortcodeHandler ( array $attributes, string $content = null ) : string Handle shortcode macro
shortcodeUI ( ) : void Describe shortcode for Shortcake UI

Protected Methods

Method Description
addPostData ( array $options, WP_Post $post ) : array Add explicit Tweet button data related to the post and its author
addPostMetaOptions ( array $options ) : array Add post meta values to a Tweet button options array

Method Details

addPostData() protected static method

Add explicit Tweet button data related to the post and its author
Since: 1.0.0
protected static addPostData ( array $options, WP_Post $post ) : array
$options array Tweet button options { @type string option name @type string|bool option value }
$post WP_Post post of interest
return array Tweet button options with possible additions based on post data { @type string option name @type string|bool option value }

addPostMetaOptions() protected static method

Add post meta values to a Tweet button options array
Since: 1.0.0
protected static addPostMetaOptions ( array $options ) : array
$options array Tweet button options array { @type string option name @type string|array option value }
return array Tweet button options array { @type string option name @type string|array option value }

getPostMeta() public static method

Get any Tweet values stored for an individual post
Since: 1.0.0
public static getPostMeta ( ) : array
return array post meta Tweet values or empty array if no values stored

init() public static method

Attach handlers for Tweet button
Since: 1.0.0
public static init ( ) : void
return void

sanitizeShortcodeParameters() public static method

Convert shortcode parameters, attributes, and defaults into a clean set of Tweet parameters
Since: 1.0.0
public static sanitizeShortcodeParameters ( array $attributes = [] ) : array
$attributes array set of shortcode attribute-value pairs or positional content matching the WordPress shortcode regex { @type string|int attribute name or positional int @type mixed shortcode value }
return array cleaned up options ready for comparison { @type string option name @type string|bool option value }

shortcodeHandler() public static method

Handle shortcode macro
Since: 1.0.0
public static shortcodeHandler ( array $attributes, string $content = null ) : string
$attributes array shortcode attributes
$content string shortcode content. no effect
return string Tweet button HTML or empty string

shortcodeUI() public static method

Describe shortcode for Shortcake UI
Since: 1.1.0
public static shortcodeUI ( ) : void
return void

Property Details

$SHORTCODE_DEFAULTS public_oe static_oe property

Accepted shortcode attributes and their default values
Since: 1.0.0
public static $SHORTCODE_DEFAULTS