PHP Class Jetpack_Likes, jetpack

Mostra file Open project: automattic/jetpack Class Usage Examples

Public Properties

Property Type Description
$version

Public Methods

Method Description
__construct ( )
action_init ( )
add_like_count_column ( array $columns ) : array Add a "Likes" column header to the post edit table in wp-admin.
add_likes_to_sharing_meta_box_title ( ) Replaces the "Sharing" title for the post screen metabox with "Likes and Shares"
add_meta_box ( ) Adds a metabox to the post screen if the sharing one doesn't currently exist.
admin_bar_likes ( )
admin_discussion_likes_settings_field ( )
admin_discussion_likes_settings_init ( ) Options to be added to the discussion page (see also admin_settings_init, etc below for Sharing settings page)
admin_discussion_likes_settings_section ( )
admin_discussion_likes_settings_validate ( $input )
admin_init ( )
admin_likes_get_option ( $option )
admin_settings_callback ( ) Saves the setting in the database, bumps a stat on WordPress.com
admin_settings_init ( ) The actual options block to be inserted into the sharing page.
admin_settings_showbuttonon_callback ( ) If sharedaddy is not loaded, we still need to save the the settings of the "Show buttons on" option.
admin_settings_showbuttonon_init ( ) If sharedaddy is not loaded, we don't have the "Show buttons on" yet, so we need to add that since it affects likes too.
comment_likes ( $content, $comment = null )
configuration_redirect ( ) Redirects to the likes section of the sharing page.
configuration_target_area ( string $html = '' ) : string Adds in the jetpack-targetable class so when we visit sharing#likes our like settings get highlighted by a yellow box
delete_social_notifications_like ( ) : null Delete the social_notifications_like option that was set to on on module activation.
enable_comment_likes ( $blog_id ) Force comment likes on for a blog Used when a new blog is created
enqueue_admin_scripts ( ) Load the JS required for loading the like counts.
get_options ( ) : array Get the 'disabled_likes' option from the DB of the current blog.
init ( )
is_admin_bar_button_visible ( )
is_attachment_enabled ( ) : boolean Are Media Likes enabled on single pages?
is_comments_enabled ( ) : boolean Returns if comment likes are enabled. Defaults to 'off'
is_enabled_sitewide ( ) : boolean Returns the current state of the "WordPress.com Likes are" option.
is_index_enabled ( ) : boolean Are Post Likes enabled on archive/front/search pages?
is_likes_visible ( ) Are likes visible in this context?
is_post_likeable ( integer $post_id ) Are likes enabled for this post?
is_single_page_enabled ( ) : boolean Are Post Likes enabled on single pages?
is_single_post_enabled ( String $post_type = 'post' ) : boolean Are Post Likes enabled on single posts?
likes_edit_column ( string $column_name, integer $post_id ) Add "Likes" column data to the post edit table in wp-admin.
likes_master ( ) This function needs to get loaded after the scripts get added to the page.
load_admin_css ( ) Load the CSS needed for the wp-admin area.
load_jp_css ( ) Loads Jetpack's CSS on the sharing page so we can use .jetpack-targetable
load_styles_register_scripts ( ) : null Load scripts and styles for front end.
meta_box_content ( $post ) Shows the likes option in the post screen metabox.
meta_box_save ( $post_id )
post_flair_service_enabled_like ( $classes )
post_likes ( $content )
process_update_requests_if_sharedaddy_not_loaded ( ) Adds the admin update hook so we can save settings even if Sharedaddy is not enabled.
reblogs_enabled_sitewide ( ) : boolean Returns the current state of the "WordPress.com Reblogs are" option.
register_scripts ( ) Register scripts
set_social_notifications_like ( ) : null Set the social_notifications_like option to on when the Likes module is activated.
sharing_block ( ) Returns just the "sharing buttons" w/ like option block, so it can be inserted into different sharing page contexts
sharing_menu ( ) Adds the 'sharing' menu to the settings menu.
sharing_meta_box_content ( $post ) WordPress.com: Metabox option for sharing (sharedaddy will handle this on the JP blog)
sharing_page ( ) Provides a sharing page with the sharing_global_options hook so we can display the setting.
updated_message ( ) Returns the settings have been saved message.

Method Details

__construct() public method

public __construct ( )

action_init() public method

public action_init ( )

add_like_count_column() public method

Add a "Likes" column header to the post edit table in wp-admin.
public add_like_count_column ( array $columns ) : array
$columns array
return array

add_likes_to_sharing_meta_box_title() public method

Replaces the "Sharing" title for the post screen metabox with "Likes and Shares"

add_meta_box() public method

Adds a metabox to the post screen if the sharing one doesn't currently exist.
public add_meta_box ( )

admin_bar_likes() public method

public admin_bar_likes ( )

admin_discussion_likes_settings_field() public method

admin_discussion_likes_settings_init() public method

Options to be added to the discussion page (see also admin_settings_init, etc below for Sharing settings page)

admin_discussion_likes_settings_section() public method

admin_discussion_likes_settings_validate() public method

admin_init() public method

public admin_init ( )

admin_likes_get_option() public method

public admin_likes_get_option ( $option )

admin_settings_callback() public method

Saves the setting in the database, bumps a stat on WordPress.com

admin_settings_init() public method

The actual options block to be inserted into the sharing page.
public admin_settings_init ( )

admin_settings_showbuttonon_callback() public method

If sharedaddy is not loaded, we still need to save the the settings of the "Show buttons on" option.

admin_settings_showbuttonon_init() public method

If sharedaddy is not loaded, we don't have the "Show buttons on" yet, so we need to add that since it affects likes too.

comment_likes() public method

public comment_likes ( $content, $comment = null )

configuration_redirect() public method

Redirects to the likes section of the sharing page.

configuration_target_area() public method

Adds in the jetpack-targetable class so when we visit sharing#likes our like settings get highlighted by a yellow box
public configuration_target_area ( string $html = '' ) : string
$html string row heading for the sharedaddy "which page" setting
return string html with the jetpack-targetable class and likes id. tbody gets closed after the like settings

delete_social_notifications_like() public method

Delete the social_notifications_like option that was set to on on module activation.
Since: 3.7.0

enable_comment_likes() public method

Force comment likes on for a blog Used when a new blog is created
public enable_comment_likes ( $blog_id )

enqueue_admin_scripts() public method

Load the JS required for loading the like counts.

get_options() public method

Get the 'disabled_likes' option from the DB of the current blog.
public get_options ( ) : array
return array

init() public static method

public static init ( )

is_admin_bar_button_visible() public method

is_attachment_enabled() public method

Are Media Likes enabled on single pages?
public is_attachment_enabled ( ) : boolean
return boolean

is_comments_enabled() public method

Returns if comment likes are enabled. Defaults to 'off'
public is_comments_enabled ( ) : boolean
return boolean true if we should show comment likes, false if not

is_enabled_sitewide() public method

Returns the current state of the "WordPress.com Likes are" option.
public is_enabled_sitewide ( ) : boolean
return boolean true if enabled sitewide, false if not

is_index_enabled() public method

Are Post Likes enabled on archive/front/search pages?
public is_index_enabled ( ) : boolean
return boolean

is_likes_visible() public method

Some of this code was taken and modified from sharing_display() to ensure similar logic and filters apply here, too.
public is_likes_visible ( )

is_post_likeable() public method

Are likes enabled for this post?
public is_post_likeable ( integer $post_id )
$post_id integer

is_single_page_enabled() public method

Are Post Likes enabled on single pages?
public is_single_page_enabled ( ) : boolean
return boolean

is_single_post_enabled() public method

Are Post Likes enabled on single posts?
public is_single_post_enabled ( String $post_type = 'post' ) : boolean
$post_type String custom post type identifier
return boolean

likes_edit_column() public method

Add "Likes" column data to the post edit table in wp-admin.
public likes_edit_column ( string $column_name, integer $post_id )
$column_name string
$post_id integer

likes_master() public method

This function needs to get loaded after the scripts get added to the page.
public likes_master ( )

load_admin_css() public method

Load the CSS needed for the wp-admin area.
public load_admin_css ( )

load_jp_css() public method

Loads Jetpack's CSS on the sharing page so we can use .jetpack-targetable
public load_jp_css ( )

load_styles_register_scripts() public method

Load scripts and styles for front end.
public load_styles_register_scripts ( ) : null
return null

meta_box_content() public method

Shows the likes option in the post screen metabox.
public meta_box_content ( $post )

meta_box_save() public method

public meta_box_save ( $post_id )

post_flair_service_enabled_like() public method

public post_flair_service_enabled_like ( $classes )

post_likes() public method

public post_likes ( $content )

process_update_requests_if_sharedaddy_not_loaded() public method

Adds the admin update hook so we can save settings even if Sharedaddy is not enabled.

reblogs_enabled_sitewide() public method

Returns the current state of the "WordPress.com Reblogs are" option.
public reblogs_enabled_sitewide ( ) : boolean
return boolean true if enabled sitewide, false if not

register_scripts() public method

Register scripts
public register_scripts ( )

set_social_notifications_like() public method

Set the social_notifications_like option to on when the Likes module is activated.
Since: 3.7.0

sharing_block() public method

Returns just the "sharing buttons" w/ like option block, so it can be inserted into different sharing page contexts
public sharing_block ( )

sharing_menu() public method

Only ran if sharedaddy and publicize are not already active.
public sharing_menu ( )

sharing_meta_box_content() public method

WordPress.com: Metabox option for sharing (sharedaddy will handle this on the JP blog)
public sharing_meta_box_content ( $post )

sharing_page() public method

Only ran if sharedaddy and publicize are not already active.
public sharing_page ( )

updated_message() public method

Returns the settings have been saved message.
public updated_message ( )

Property Details

$version public_oe property

public $version