I have modified your code as following and it is working for me.
I have removed the constructor from your code and added the code in method and called that method using object.
if (is_admin()){
add_action('load-post.php', array('Mighty_Metabox' , 'Custom_Mighty_Metabox'));
}
//the class
class Mighty_Metabox{
//the vars
public $id = false;
public $title = false;
public $callback = array();
public $post_type = array();
public $context = false;
public $priority = false;
public $callback_args = array();
public $template = false;
public function Custom_Mighty_Metabox($params=false){
if($params){
//arrange params as key => value pairs
foreach($params as $key => $value){
$this->{$key} = $value;
}
//if admin page, add the action - add (metabox)
if(is_admin){
//set the callback to create metabox
$this->callback = array($this, '_create');
//add the add metabox action
add_action('add_meta_boxes', array($this, '_add'));
//add the save metabox action
add_action('save_post', array($this,'_save'));
}
}
}
function _add(){
//add the metabox with user set params
add_meta_box($this->id, $this->title, $this->callback, $this->post_type, $this->context, $this->priority, $this->callback_args);
}
function _create(){
//create the metabox
include($this->template);
// create a nonce for verification
echo '<input type="hidden" name="'. $this->id .'_nonce" value="' . wp_create_nonce($this->id) . '" />';
}
function _save(){
// verify if this is an auto save routine.
// If it is our form has not been submitted, so we dont want to do anything
if (defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE) {
return;
}
// verify this came from the our screen and with proper authorization,
// because save_post can be triggered at other times
$nonce = isset($_POST[$this->id.'_nonce']) ? $_POST[$this->id.'_nonce'] : NULL;
if (!wp_verify_nonce($nonce, $this->id)){
return $post_id;
}
$this->_debug(false); // won't get here on page load
}
private function _debug($exit=true){
// var_dump(debug_backtrace());
return ($exit)? exit(): false;
}
}
$args = array
(
'id' => '_subtitle',
'title' => 'Subtitle',
'post_type' => 'post',
'context' => 'normal',
'priority' => 'high',
'template' => 'subtitle.php'
);
//subtitle metabox
$subtitle_mb = new Mighty_Metabox();
$subtitle_mb->Custom_Mighty_Metabox($args);