| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Events

Page history last edited by emolasses 15 years, 6 months ago

CodeExtinguisher employs the excellent Khaos :: EventManager library to handle system-wide events. The codexevents.php file in the khaos/plugins/ directory contains the default events. If you want to add you own code (which doesn't override the default events), then you can refer to the EventManager documentation (link provided earlier) to add them.

 

Here is a list of events and their purpose:

 

preInsertHook($data=array())

Gets called before $data is to be sent to the database for insertion. Calls preInsertHook on each plugin.

 

postInsertHook($data=array())

Gets called after $data is formatted for the database, and inserted. Calls postInsertHook on each plugin.

 

preEditHook($table,$id) 

Gets called before $data is to be sent to the database to be updated. Calls preEditHook on each plugin.

 

postEditHook($data) 

Gets called after $data is formatted for the database, and updated. Calls postEditHook on each plugin.

 

preDeleteHook($table,$id) 

Gets called before $id is to be deleted from $table. Calls preDeleteHook on each plugin.

 

postDeleteHook($table,$id) 

Gets called after $id is deleted for $table. Calls postDeleteHook on each plugin.

 

checkRecordOwnership($action,$table,$id)

Establishes that the user has the ability to do $action on the record of $id in $table. If this function returns true, then the user is allowed to take that action. Otherwise, he will get a message telling him that he doesn't have the proper permission.

 

getDbFields($data=array())

Calls getFieldName() on each plugin when data is being requested from the database. Each plugin (unless overridden), returns the name of that plugin as the name of the field. Plugins that return NULL are removed from the return array of this function. This is useful in situations where the plugin doesn't have an associated field in the table (ManyToMany, OneToMany, Template, etc..)

 

getQueryFields($data=array()) 

Calls getQueryName() on each plugin when the main query is getting constructed. getQueryName() in turns calls getFieldName() which returns the name of that plugin as the name of the field. Next, getQueryName prepends the name of the table to the field name. This is very useful when plugins store information in other tables (ManyToMany, OneToMany), and that information needs to get JOIN'd in the main query. Plugins that return NULL are removed from the return array of this function. 

 

prepForDisplay($data=array())

  • Prepares the $data for display by calling prepForDisplay on each plugin. By default, this filters the data by passing it through htmlspecialchars() and then stripslashes(). If your own plugin overloads this function, then make sure you still filter the data, so you don't open yourself to XSS attacks.
  • Return NULL from prepForDb or prepForDisplay and CE will not process that data into the db

 

prepForDelete($table,$id)

Similar to prepForDisplay, except it doesn't do anything by default, and is there in case your own plugins need to overlaod it.

 

prepForDb($data=array()) 

  • Similar to prepForDisplay, except it filters the data by passing it through mysql_real_escape_string to prevent SQL injection attacks.
  • Return NULL from prepForDb or prepForDisplay and CE will not process that data into the db

 

getDbTables() Returns the name of the table associated with that field. Used in the getQueryName() function.

Comments (0)

You don't have permission to comment on this page.