AtomAppCallback
AtomAppCallback, for adding callbacks to Atom entry posting
AtomAppCallback enables the creation of Movable Type plugins that hook into the creation of new entries posted with the Atom API.
Using AtomAppCallback
AtomAppCallback provides three callbacks. Plugins register them in the normal way, that is:
MT->add_callback('AtomNewEntryPreSave', 5, $plugin_obj, \&my_callback);
The callbacks are:
AtomNewEntryPreCreate($cb, $app, $atom_entry)
This callback is invoked before Movable Type begins to build the MT::Entry for the given XML::Atom::Entry. Modifying $atom_entry will affect how the MT::Entry is built by Movable Type.
AtomNewEntryPreSave($cb, $app, $atom_entry, $entry, $orig_entry)
This callback is invoked when the new MT::Entry created from $atom_entry is being saved.
AtomNewEntryPostSave($cb, $app, $atom_entry, $entry, $orig_entry)
This callback is invoked when the new MT::Entry created from $atom_entry has just been saved.
Sample plugins
Two sample plugins that use these callbacks are included. If you do not wish to use them, don't install them, or disable them on the Movable Type System Overview → Plugins page.
UniqueID
This plugin uses the AtomNewEntryPreSave callback to (a) reuse the Atom entry id, if included in the post, as the new MT::Entry's Atom id, and (b) prevent creation of duplicate items posted with the same Atom id by interpreting the duplicate post as an update to the existing entry.
KeywordSubject
This plugin uses the AtomNewEntryPreCreate and AtomNewEntryPreSave callbacks to save dc:subjects in the posted Atom entry as a set of keywords instead of as a category name.
Leave a comment