/** * Return an instance of this class. * * @since 1.0.0 * * @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. * * @since 1.0.0 */ private function __construct() { // Call $plugin_slug from public plugin class. $plugin = Gravity_Forms_Math_Captcha::get_instance(); $this->plugin_slug = $plugin->get_plugin_slug(); // Add an admin notice if Gravity Forms isn't installed. add_action('admin_notices', array($this, 'admin_warning')); // Add the math captcha field to the Gravity Forms editor. add_filter('gform_add_field_buttons', array($this, 'add_math_captcha_field')); add_filter('gform_field_type_title', array($this, 'add_math_captcha_title'), 10, 2); add_action('gform_editor_js', array($this, 'math_captcha_gform_editor_js')); add_action('gform_field_standard_settings', array($this, 'math_captcha_settings'), 10, 2); add_filter('gform_tooltips', array($this, 'math_captcha_type_tooltip')); }