Meet the Functions!

While working with a few bugs and features, finally after quite a bit of struggle with the code, I kind of felt that a brief introduction to the functions that I am dealing with would be good to be documented. So, here is it – Our EtherEditorPad.php  file at a glance!

EtherEditorPad.php

__construct (): Creates a new pad. Parameters:  $id, $epid, $groupId, $pageTitle,  $baseRevision, are passed.

getEpClient (): Returns an EtherpadLiteClient from the current $wgEtherPadConfig values.

newFromNameAndText (): Returns the public pad with specified title, or a new pad with the specified text if there is no such pad.

newFromOldPadId (): Returns a new pad with the same text as the old pad. Parameters: string $padId the ID for the old pad, User $username the user who will be administrator are passed. Calls newFromId () from within, and newFromDB() as well- returns EtherEditorPad.

newFromId (): Returns the pad with specified ID, or false if there is no such pad.

newFromDB (): Returns a new instance of EtherEditorPad built from a database result obtained by doing a select with the provided conditions on the pads table. If no pad matches the conditions and the conditions cannot be artifically met, false will be returned. Parameters: array $conditions the stuff to put into the database, string $text the text to put into the pad right away, integer $currentRevision the current revision of the page are passed.

newRemotePad (): Makes a new remote pad. Calls: getEpClient()and then, createGroupPad ()is called as well, which is basically takes the flow to EtherpadliteClient.php

authenticateUser ():  Authenticates a user to the group. Also adds them to the list of collaborators in the database.

kickUser (): Kicks a user from the pad. Also removes them from the list of collaborators in the database. Parameters: string $username the user doing the kicking, string $kickusername the username to kick, int $kickuserid the user id to kick

isAdmin (): Checks whether a user is admin. Parameter: string $username the user to check, is passed.

isKicked (): Checks whether a user is kicked. Parameter: string $username the user to check, is passed.

addToContribs (): Adds a user to the list of contributors. Parameters: string $username the username to add, string $authorId the authorId returned by Etherpad

removeFromContribs (): Removes a user from the list of contributors. Parameter: string $username the username to remove

getId (): Returns the ID of the pad.

getEpId (): Returns the Etherpad-generated ID of the pad.

getPageTitle (): Returns the Etherpad-generated ID of the pad.

getBaseRevision (): Returns the base revision for the pad.

getGroupId (): Returns the group ID for the pad.

getText (): Returns the text of the pad.

writeToDB (): Write the pad to the DB. If it’s already there, it’ll be updated, else it’ll be inserted.

insertIntoDB (): Insert the pad into the DB.

updateInDB (): Update the pad in the DB.

getOtherPads (): Get other pads for this page, if they exist

getConnectedUsers (): Get the current list of contributors to this pad.

getAllByPageTitle (): Get all pads by the page title, or just all pads if no title.

Leave a Reply

Your email address will not be published. Required fields are marked *