nonces in custom oop plugin

check_admin_referer is a pluggable function which means it is defined after plugins are loaded so call your constructor or instantiate the object after or using plugins_loaded action hook.

ex:

class MyClass{
    function __construct(){ 
        if( isset($_POST['my_nonce_field']) && check_admin_referer('my_nonce_action', 'my_nonce_field'))
            $this->update_item();
    }
}

add_action('plugins_loaded','newobj');
function newobj(){
    $myclass = new MyClass;
}

tech