function register_actions() { // load the plugin's textdomain for localization add_action('init', array(&$this, 'load_textdomain')); // options register_activation_hook(WPPlugin::path_to_plugin_directory() . '/wp-recaptcha.php', array(&$this, 'register_default_options')); add_action('admin_init', array(&$this, 'register_settings_group')); if ($this->is_multi_blog()) { add_action('signup_extra_fields', array(&$this, 'show_recaptcha_in_registration')); } else { add_action('register_form', array(&$this, 'show_recaptcha_in_registration')); add_action('bp_before_registration_submit_buttons', array(&$this, 'show_recaptcha_in_registration')); add_action('bp_signup_validate', array(&$this, 'check_recaptcha_generic'), 0); } add_action('lostpassword_form', array(&$this, 'show_recaptcha_in_registration')); add_action('lostpassword_post', array(&$this, 'check_recaptcha_generic'), 0); add_action('comment_form', array(&$this, 'show_recaptcha_in_comments')); // recaptcha comment processing add_action('wp_head', array(&$this, 'saved_comment'), 0); add_action('preprocess_comment', array(&$this, 'check_comment'), 0); add_action('comment_post_redirect', array(&$this, 'relative_redirect'), 0, 2); // administration (menus, pages, notifications, etc.) add_filter("plugin_action_links", array(&$this, 'show_settings_link'), 10, 2); add_action('admin_menu', array(&$this, 'add_settings_page')); // admin notices add_action('admin_notices', array(&$this, 'missing_keys_notice')); }
function register_actions() { add_action('init', 'session_start'); add_action('wp_head', array(&$this, 'register_stylesheets')); add_action('admin_head', array(&$this, 'register_stylesheets')); register_activation_hook(WPPlugin::path_to_plugin_directory() . '/wp-confidentCaptcha.php', array(&$this, 'register_default_options')); add_action('admin_init', array(&$this, 'register_settings_group')); add_action('wp_enqueue_scripts', array(&$this, 'confidentStyle')); if ($this->options['show_in_registration']) { if ($this->is_multi_blog()) { add_action('signup_extra_fields', array(&$this, 'show_confidentCaptcha_in_registration')); } else { add_action('register_form', array(&$this, 'show_confidentCaptcha_in_registration')); } } if ($this->options['show_in_lost_password']) { add_action('lostpassword_form', array(&$this, 'show_confidentCaptcha_in_registration')); } if ($this->options['show_in_login_page']) { add_action('login_form', array(&$this, 'show_confidentCaptcha_in_registration')); } if ($this->options['show_in_comments']) { add_action('comment_form', array(&$this, 'show_confidentCaptcha_in_comments')); add_action('wp_head', array(&$this, 'saved_comment'), 0); add_action('preprocess_comment', array(&$this, 'check_comment'), 0); add_action('comment_post_redirect', array(&$this, 'relative_redirect'), 0, 2); } add_filter("plugin_action_links", array(&$this, 'show_settings_link'), 10, 2); add_action('admin_menu', array(&$this, 'add_settings_page')); add_action('admin_notices', array(&$this, 'missing_keys_notice')); //Callback related actions and filters for AJAX verification add_filter('query_vars', array(&$this, 'callback_rewrite_filter')); add_action('parse_request', array(&$this, 'callback_rewrite_parse_request')); }
function register_actions() { // load the plugin's textdomain for localization add_action('init', array(&$this, 'load_textdomain')); // styling add_action('wp_head', array(&$this, 'register_stylesheets')); // make unnecessary: instead, inform of classes for styling add_action('admin_head', array(&$this, 'register_stylesheets')); // make unnecessary: shouldn't require styling in the options page if ($this->options['show_in_registration']) { add_action('login_head', array(&$this, 'registration_style')); } // make unnecessary: instead use jQuery and add to the footer? // options register_activation_hook(WPPlugin::path_to_plugin_directory() . '/wp-recaptcha.php', array(&$this, 'register_default_options')); // this way it only happens once, when the plugin is activated add_action('admin_init', array(&$this, 'register_settings_group')); // only register the hooks if the user wants recaptcha on the registration page if ($this->options['show_in_registration']) { // recaptcha form display if ($this->is_multi_blog()) { add_action('signup_extra_fields', array(&$this, 'show_recaptcha_in_registration')); } else { add_action('register_form', array(&$this, 'show_recaptcha_in_registration')); } } // only register the hooks if the user wants recaptcha on the comments page if ($this->options['show_in_comments']) { add_action('comment_form', array(&$this, 'show_recaptcha_in_comments')); add_action('wp_footer', array(&$this, 'save_comment_script')); // preserve the comment that was entered // recaptcha comment processing (look into doing all of this with AJAX, optionally) add_action('wp_head', array(&$this, 'saved_comment'), 0); add_action('preprocess_comment', array(&$this, 'check_comment'), 0); add_action('comment_post_redirect', array(&$this, 'relative_redirect'), 0, 2); } // administration (menus, pages, notifications, etc.) add_filter("plugin_action_links", array(&$this, 'show_settings_link'), 10, 2); add_action('admin_menu', array(&$this, 'add_settings_page')); // admin notices add_action('admin_notices', array(&$this, 'missing_keys_notice')); }
function require_library() { require_once WPPlugin::path_to_plugin_directory() . '/recaptchalib.php'; }
static function path_to_plugin($file_path) { $file_name = basename($file_path); // /etc/blah/file.txt => file.txt if (WPPlugin::determine_environment() == Environment::WordPressMU) { return WPPlugin::plugins_directory() . "/{$file_name}"; } else { return WPPlugin::path_to_plugin_directory() . "/{$file_name}"; } }