MVC
Model–view–controller (MVC) is a software design pattern for implementing user interfaces on computers. It divides a given software application into three interconnected parts, so as to separate internal representations of information from the ways that information is presented to or accepted from the user.
[wikipedia]
How does it work?
The MVC implemented in the framework is a modified and improved version of a forked project named Lightweight MVC; it utilizes existing WordPress functionality to prevent overloading the already heavy loaded WordPress core.
Usage
MVC is integrated into the Main Class and can be accessed by calling to the property $this->mvc
.
class Main extends Bridge { public function on_admin() { // Hook "save_post" added using legacy function instead // of Main Class definition. add_action( 'save_post', array( &$this, 'custom_save_post' ) ); } /** * Legacy handler for action "save_post". * Use of MVC engine. */ public function custom_save_post( $post_id ) { $this->mvc->call( 'PostController@save', $post_id ); } }
In the sample above, a WordPress action hook is added to the Main Class using legacy functions (WordPress very own add_action) and in the handler, the MVC property is called.