Captcha and Contact Us Forms for Wordpress 0.0.1
Plugin to add captcha to core wordpress forms and additional option for contact us page.
custCaptchaContact.php File Reference

Bootstrap file for this plugin. More...

Functions

 osolAutoLoadRegisterCalled ()
 Dummy function to mention spl_autoload_register(function ($class) is called. After registering this autoload function with SPL, the following line would cause the function to attempt to load the \Foo\Bar\Baz\Qux class from /path/to/project/src/Baz/Qux.php: More...
 
 osolwpccc_custom_javascript ()
 

Variables

const CUST_CAPTCHA_FOLDER dirname(__FILE__)
 constant holding file path of this plugin. More...
 
const CUST_CAPTCHA_MVC_ROOT_FOLDER dirname(__FILE__)."/MVC"
 constant holding file root of MVC(private folder) this plugin. More...
 
const CUST_CAPTCHA_DIR_URL plugin_dir_url(__FILE__)
 
 $OSOLCCC_Frontend_inst = \OSOLCCC\Hooks\Frontend::getInstance()
 
 $OSOLCCC_Admin_inst = \OSOLCCC\Hooks\Admin::getInstance()
 
 $OSOLCCC_CommonClass_inst = \OSOLCCC\Hooks\Common::getInstance()
 
 $GLOBALS ['OSOLMulticaptcha_captcha_enabled'] = get_option('cust_captcha_status')
 Determines wether captcha is enabled, ie to be shown in forms. More...
 
 $GLOBALS ['OSOLMulticaptcha_gdprCompliantNoCookie'] = get_option('OSOLMulticaptcha_gdprCompliantNoCookie')
 Determines wether captcha should be based on session/cookie(default) or GDPR Compliant. More...
 
 $login_captcha = get_option('OSOLMulticaptcha_cust_captcha_login')
 Determines wether captcha is enabled in login form. More...
 
 $comment_captcha = get_option('OSOLMulticaptcha_cust_captcha_comments')
 Determines wether captcha is enabled in comment form. More...
 
 $register_captcha = get_option('OSOLMulticaptcha_cust_captcha_register')
 Determines wether captcha is enabled in sign up form. More...
 
 $lost_captcha = get_option('OSOLMulticaptcha_cust_captcha_lost')
 Determines wether captcha is enabled in loas password form. More...
 

Detailed Description

Bootstrap file for this plugin.

Starting point of the project.
This file bootstraps the operations of this project
This documentation is shown because file tag is used.
This will appear under Main Project >> Files >> File List >> thisFileName

Hooks Used:
Two Types of WordPress Hooks: Actions and Filters. WordPress includes two types of hooks called Actions and Filters. Actions let you do something at certain predefined points in the WordPress runtime, while Filters let you modify any data processed by WordPress and return it.
hooks are extracted with
//add_action\‍('([^']+)',\s*'([^']+)' replace with add_action('\1',[$OSOL_CCC_HandlerFrontEnd_inst,'\2']
//add_action\‍('([^']+)',([^/\r\n]+)
add_action hooks
  1. add_action('wp', function () { // see all functions hooked to 'wp_footer'
  2. add_action('init',// init for admin is 'admin_init' hook
  3. add_action'wp_head',
  4. add_action'wp_enqueue_scripts',//load jquery in wp_head for contact page since jQuery(document).ready is used
  5. add_action( 'wp_footer', [$OSOLCCC_CommonClass_inst,'add_ccc_onload'] ); // For front-end to call refresh captcha
  6. add_action'login_form',
  7. add_action( 'comment_form_after_fields', [$OSOLCCC_Frontend_inst,'include_cust_captcha_comment_form_wp3'], 1 );
  8. add_action( 'comment_form_logged_in_after', [$OSOLCCC_Frontend_inst,'include_cust_captcha_comment_form_wp3'], 1 );
  9. add_action( 'comment_form', [$OSOLCCC_Frontend_inst,'include_cust_captcha_comment_form'] );
  10. add_action'register_form',// add captcha html in register form
  11. add_action( 'register_post', [$OSOLCCC_Frontend_inst,'include_cust_captcha_register_post'], 10, 3 );// perform plugin specific actions upon user registration
  12. add_action( 'signup_extra_fields', [$OSOLCCC_Frontend_inst,'include_cust_captcha_register'] );// add captcha html in register form
  13. add_action( 'lostpassword_form', [$OSOLCCC_Frontend_inst,'include_cust_captcha_lostpassword'] );
  14. add_action( 'lostpassword_post', [$OSOLCCC_Frontend_inst,'include_cust_captcha_lostpassword_post'], 10, 3 );
  15. add_action'admin_init',
  16. add_action'admin_menu',
  17. add_action( 'admin_footer', [$OSOLCCC_CommonClass_inst,'add_ccc_onload'] ); // For back-end to call refresh captcha
  18. add_action'admin_enqueue_scripts',//load jquery in wp_head for contact page since jQuery(document).ready is used
  19. add_action'wp_ajax_cccontact_display_captcha',// executed when logged in
  20. add_action'wp_ajax_nopriv_cccontact_display_captcha',// executed when logged out
  21. add_action('wp_ajax_cccontact_tb_show_modal' , [$OSOLCCC_Frontend_inst,'cccontact_tb_show_modal']);// executed when logged in
  22. add_action'wp_ajax_nopriv_cccontact_tb_show_modal',// executed when logged out
  23. add_action'wp_ajax_cccontact_validate_ajax',// executed when logged in
  24. add_action'wp_ajax_nopriv_cccontact_validate_ajax',// executed when logged out

add_filter hooks

  1. add_filter('login_errors',[$OSOLCCC_Frontend_inst,'cust_captcha_login_errors']);
  2. add_filter( 'login_redirect', [$OSOLCCC_Frontend_inst,'include_cust_captcha_login_redirect'], 10, 3 );
  3. add_filter( 'preprocess_comment', [$OSOLCCC_Frontend_inst,'include_cust_captcha_comment_post'] );
  4. add_filter( 'wpmu_validate_user_signup', [$OSOLCCC_Frontend_inst,'include_cust_captcha_register_validate'] );// perform validation of captcha
Warning
without file tag, non class files are not documented
Also no global variables will be documented

Function Documentation

◆ osolAutoLoadRegisterCalled()

osolAutoLoadRegisterCalled ( )

Dummy function to mention spl_autoload_register(function ($class) is called. After registering this autoload function with SPL, the following line would cause the function to attempt to load the \Foo\Bar\Baz\Qux class from /path/to/project/src/Baz/Qux.php:

 new \Foo\Bar\Baz\Qux;
Parameters
functionFunction that maps called classes to appropriate source files.
Exceptions
std::fileNotFoundNo such file check the spelling of {$class}.
Returns
void.

Variable Documentation

◆ $comment_captcha

$comment_captcha = get_option('OSOLMulticaptcha_cust_captcha_comments')

Determines wether captcha is enabled in comment form.

It is set in admin panel, in "Captcha Settings"

◆ $GLOBALS [1/2]

$GLOBALS[ 'OSOLMulticaptcha_captcha_enabled'] = get_option('cust_captcha_status')

Determines wether captcha is enabled, ie to be shown in forms.

It is set in admin panel, in "Captcha Settings"

◆ $GLOBALS [2/2]

$GLOBALS[ 'OSOLMulticaptcha_gdprCompliantNoCookie'] = get_option('OSOLMulticaptcha_gdprCompliantNoCookie')

Determines wether captcha should be based on session/cookie(default) or GDPR Compliant.

It is set in admin panel, in "Captcha Settings"

◆ $login_captcha

$login_captcha = get_option('OSOLMulticaptcha_cust_captcha_login')

Determines wether captcha is enabled in login form.

It is set in admin panel, in "Captcha Settings"

◆ $lost_captcha

$lost_captcha = get_option('OSOLMulticaptcha_cust_captcha_lost')

Determines wether captcha is enabled in loas password form.

It is set in admin panel, in "Captcha Settings"

◆ $register_captcha

if($GLOBALS['OSOLMulticaptcha_captcha_enabled']=='enabled' &&($login_captcha=='yes')) if ( $GLOBALS[ 'OSOLMulticaptcha_captcha_enabled']=='enabled' &&( $comment_captcha=='yes')) $register_captcha = get_option('OSOLMulticaptcha_cust_captcha_register')

Determines wether captcha is enabled in sign up form.

It is set in admin panel, in "Captcha Settings"

◆ CUST_CAPTCHA_FOLDER

const CUST_CAPTCHA_FOLDER dirname(__FILE__)

constant holding file path of this plugin.

this constant is defined for ease of usage in all classes.
This is used in autoloader and for loading template files

◆ CUST_CAPTCHA_MVC_ROOT_FOLDER

const CUST_CAPTCHA_MVC_ROOT_FOLDER dirname(__FILE__)."/MVC"

constant holding file root of MVC(private folder) this plugin.

this constant is defined for ease of usage in all classes.
This is used in autoloader and for loading template files