Hooks to extend your plugin
-
Hello again, and thanks for your plugin, i had a few adjustments that if can be integrated will assist in hooking to your plugin where needed,
Simplify with a display function that handle both versions.
// display that handle both options function display( ) { $sgrDisplay = $this->getOptionValue(Entity::VERSION) === 3 ? 'v3Display' : 'v2Display'; $this->$sgrDisplay(); }
Add 2 apply_filters to enable hook for the required scripts and the verify
// Commented this since added generic display() function that already checkes the version //$sgrDisplay = $this->getOptionValue(Entity::VERSION) === 3 ? 'v3Display' : 'v2Display'; // add filter to allow hook on other plugins foreach ( apply_filters( 'sgr_recaptcha_display_list', $sgr_display_list ) as $sgr_display) { add_action($sgr_display, [$this, 'enqueueScripts']); add_action($sgr_display, [$this, 'display'] ); } // add filter to allow hook on other plugins foreach ( apply_filters( 'sgr_recaptcha_verify_list', $sgr_verify_list ) as $sgr_verify) { add_action($sgr_verify, [$this, 'verify']); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Hooks to extend your plugin’ is closed to new replies.