/**
  * Return an instance of this class.
  *
  * @return    object    A single instance of this class.
  */
 public static function get_instance()
 {
     // If the single instance hasn't been set, set it now.
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 /**
  * Initialize the plugin by loading admin scripts & styles and adding a
  * settings page and menu.
  */
 private function __construct()
 {
     $plugin = WP_Hashcash::get_instance();
     $this->plugin_slug = $plugin->get_plugin_slug();
     // Add the options page and menu item.
     add_action('admin_menu', array($this, 'add_plugin_admin_menu'));
     // Settings
     add_action('admin_init', array($this, 'settings_api'));
 }
function wpcf7_hashcash_validation_filter($result, $tag)
{
    if (!class_exists('WP_Hashcash')) {
        die("WP_Hashcash Class is not available.");
    }
    $instance = WP_Hashcash::get_instance();
    $tag = new WPCF7_Shortcode($tag);
    $hashcashid = $_POST['hashcashid'];
    if (!$hashcashid) {
        die("hashcashid value is not available.");
    }
    $type = $tag->type;
    $name = $tag->name;
    $op = wpcf7_hashcash_options($tag->options);
    $hashcash_result = $instance->verify_hash($hashcashid, $op['complexity']);
    if ($hashcash_result !== 'ok') {
        $result['valid'] = false;
        $result['reason'][$name] = wpcf7_get_message('hashcash_error');
    }
    if (isset($result['reason'][$name]) && ($id = $tag->get_id_option())) {
        $result['idref'][$name] = $id;
    }
    return $result;
}