First go to http://pkg.io/ and get the database extension file.
You probably want to use the "safecracker_submit_entry_start" hook to throw an error if an unclean word is entered. The most important part of the extension is registering the method and binding that you want to use, otherwise none of these codes will be launched.
Your code should look something like this:
public function activate_extension() { // Setup custom settings in this array. $this->settings = array(); $data = array( 'class' => __CLASS__, 'method' => 'clean', // point to the method that should run 'hook' => 'safecracker_submit_entry_end', // point to the hook you want to use to trigger the above method. 'settings' => serialize($this->settings), 'version' => $this->version, 'enabled' => 'y' ); $this->EE->db->insert('extensions', $data); }
Once the method has been called, you can start the cleanup. Make sure you pass the safecracker object to your clean method when defining it. For instance:
public function clean($sc){ print_r($sc); }
source share