Likes

Class Likes
Methods Summary
public
# __construct( )
Likes::__construct() Sets the basic data needed for the rest of the process.
public
# call( )
Likes::call() The main handler. Verifies permissions (whether the user can see the content in question), dispatch different method for different sub-actions. Accessed from index.php?action=likes
public
# get( string $property = '' )
Likes::get() A simple getter for all protected properties. Accessed from index.php?action=likes
protected
# check( )
Likes::check() Performs basic checks on the data provided, checks for a valid msg like. Calls integrate_valid_likes hook for retrieving all the data needed and apply checks based on the data provided.
protected
# delete( )
Likes::delete() Deletes an entry from user_likes table, needs 3 properties: $_content, $_type and $_user['id'].
protected
# insert( )
Likes::insert() Inserts a new entry on user_likes table. Creates a background task for the inserted entry.
protected
# _count( )
Likes::_count() Sets $_numLikes with the actual number of likes your content has, needs two properties: $_content and $_view. When called directly it will return the number of likes as response.
protected
# like( )
Likes::like() Performs a like action, either like or unlike. Counts the total of likes and calls a hook after the event.
public
# msgIssueLike( )
Likes::msgIssueLike() Partly it indicates how it's supposed to work and partly it deals with updating the count of likes attached to this message now.
public
# view( )
Likes::view() This is for viewing the people who liked a thing. Accessed from index.php?action=likes;view and should generally load in a popup. We use a template for this in case themers want to style it.
protected
# response( )
Likes::response() Checks if the user can use JavaScript and acts accordingly. Calls the appropriate sub-template for each method Handles error messages.
protected
# jsonResponse( )
Outputs a JSON-encoded response
Properties Summary
protected bool $_js
# false
protected string $_error
# false
protected string $_type
# ''
protected string $_extra
# false
protected int $_content
# 0
protected int $_numLikes
# 0
protected bool $_alreadyLiked
# false
protected array $_validLikes
# array ( 'can_like' => false, 'redirect' => '', 'type' => '', 'flush_cache' => '', 'callback' => false, 'json' => false, )
protected array $_user
# NULL
protected int $_idTopic
# 0
protected bool $_setResponse
# true