PHP 클래스 Phergie_Plugin_Karma, phergie

저자: Phergie Development Team ([email protected])
상속: extends Phergie_Plugin_Abstract
파일 보기 프로젝트 열기: phergie/phergie

보호된 프로퍼티들

프로퍼티 타입 설명
$db resource SQLite object
$fetchFixedKarma PDOStatement Retrieves an existing fixed karma record
$fetchKarma PDOStatement Retrieves an existing karma record
$fetchNegativeAnswer PDOStatement Retrieves a negative answer for a karma comparison
$fetchPositiveAnswer PDOStatement Retrieves a positive answer for a karma comparison
$insertKarma PDOStatement Prepared statement to add a new karma record
$updateKarma PDOStatement Prepared statement to update an existing karma record

공개 메소드들

메소드 설명
getDb ( ) : PDO Returns a connection to the plugin database, initializing one if none is explicitly set.
onCommandKarma ( string $term ) : void Get the karma rating for a given term.
onCommandReincarnate ( string $term ) : void Resets the karma for a term to 0.
onLoad ( ) : void Check for dependencies and initializes a database connection and prepared statements.
onPrivmsg ( ) : void Intercepts a message and processes any contained recognized commands.
setDb ( PDO $db ) : Phergie_Plugin_Karma Sets the connection to the plugin database, mainly intended for unit testing.

보호된 메소드들

메소드 설명
compareKarma ( string $term0, string $term1, string $method ) : void Compares the karma between two terms. Optionally increases/decreases the karma of either term.
fetchFixedKarma ( string $term ) : string Returns a phrase describing the karma rating for a specified term for which the karma rating is fixed.
fetchKarma ( string $term ) : integer | boolean Returns the karma rating for a specified term for which the karma rating can be modified.
getCanonicalTerm ( string $term ) : string Get the canonical form of a given term.
initializePreparedStatements ( ) : void Initializes prepared statements used by the plugin.
modifyKarma ( string $term, string $action ) : integer Modifes a term's karma.

메소드 상세

compareKarma() 보호된 메소드

Compares the karma between two terms. Optionally increases/decreases the karma of either term.
protected compareKarma ( string $term0, string $term1, string $method ) : void
$term0 string First term
$term1 string Second term
$method string Comparison method (< or >)
리턴 void

fetchFixedKarma() 보호된 메소드

Returns a phrase describing the karma rating for a specified term for which the karma rating is fixed.
protected fetchFixedKarma ( string $term ) : string
$term string Term for which to fetch the corresponding karma rating
리턴 string Phrase describing the karma rating, which may be append to the term to form a complete response

fetchKarma() 보호된 메소드

Returns the karma rating for a specified term for which the karma rating can be modified.
protected fetchKarma ( string $term ) : integer | boolean
$term string Term for which to fetch the corresponding karma rating
리턴 integer | boolean Integer value denoting the term's karma or FALSE if there is the specified term has no associated karma rating

getCanonicalTerm() 보호된 메소드

In the canonical form all sequences of whitespace are replaced by a single space and all characters are lowercased.
protected getCanonicalTerm ( string $term ) : string
$term string Term for which a canonical form is required
리턴 string Canonical term

getDb() 공개 메소드

Returns a connection to the plugin database, initializing one if none is explicitly set.
public getDb ( ) : PDO
리턴 PDO Database connection

initializePreparedStatements() 보호된 메소드

Initializes prepared statements used by the plugin.
protected initializePreparedStatements ( ) : void
리턴 void

modifyKarma() 보호된 메소드

Modifes a term's karma.
protected modifyKarma ( string $term, string $action ) : integer
$term string Term to modify
$action string Karma action (either ++ or --)
리턴 integer Modified karma rating

onCommandKarma() 공개 메소드

Get the karma rating for a given term.
public onCommandKarma ( string $term ) : void
$term string Term for which the karma rating needs to be retrieved
리턴 void

onCommandReincarnate() 공개 메소드

Resets the karma for a term to 0.
public onCommandReincarnate ( string $term ) : void
$term string Term for which to reset the karma rating
리턴 void

onLoad() 공개 메소드

Check for dependencies and initializes a database connection and prepared statements.
public onLoad ( ) : void
리턴 void

onPrivmsg() 공개 메소드

Intercepts a message and processes any contained recognized commands.
public onPrivmsg ( ) : void
리턴 void

setDb() 공개 메소드

Sets the connection to the plugin database, mainly intended for unit testing.
public setDb ( PDO $db ) : Phergie_Plugin_Karma
$db PDO Database connection
리턴 Phergie_Plugin_Karma Provides a fluent interface

프로퍼티 상세

$db 보호되어 있는 프로퍼티

SQLite object
protected resource $db
리턴 resource

$fetchFixedKarma 보호되어 있는 프로퍼티

Retrieves an existing fixed karma record
protected PDOStatement $fetchFixedKarma
리턴 PDOStatement

$fetchKarma 보호되어 있는 프로퍼티

Retrieves an existing karma record
protected PDOStatement $fetchKarma
리턴 PDOStatement

$fetchNegativeAnswer 보호되어 있는 프로퍼티

Retrieves a negative answer for a karma comparison
protected PDOStatement $fetchNegativeAnswer
리턴 PDOStatement

$fetchPositiveAnswer 보호되어 있는 프로퍼티

Retrieves a positive answer for a karma comparison
protected PDOStatement $fetchPositiveAnswer
리턴 PDOStatement

$insertKarma 보호되어 있는 프로퍼티

Prepared statement to add a new karma record
protected PDOStatement $insertKarma
리턴 PDOStatement

$updateKarma 보호되어 있는 프로퍼티

Prepared statement to update an existing karma record
protected PDOStatement $updateKarma
리턴 PDOStatement