plugin_name = $plugin_name; $this->version = $version; } /** * Register the stylesheets for the public-facing side of the site. * * @since 1.0.0 */ public function enqueue_styles() { //wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/addonify-recaptcha-for-edd-public.css', array(), $this->version, 'all' ); } /** * Register the JavaScript for the public-facing side of the site. * * @since 1.0.0 */ public function enqueue_scripts() { wp_register_script ( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/addonify-recaptcha-for-edd-public.js', array(), $this->version, true ); $args = array( 'showRecaptchaInLogin' => false, 'showRecaptchaInRegister' => false, 'clientSecreteKey' => '' ); $edd_settings = get_option( 'edd_settings' ); if ( isset( $edd_settings['addonify_recaptcha_for_edd_show_recaptcha_in_login_form'] ) && $edd_settings['addonify_recaptcha_for_edd_show_recaptcha_in_login_form'] == '1' ) { $args['showRecaptchaInLogin'] = true; } if ( isset( $edd_settings['addonify_recaptcha_for_edd_show_recaptcha_in_register_form'] ) && $edd_settings['addonify_recaptcha_for_edd_show_recaptcha_in_register_form'] == '1' ) { $args['showRecaptchaInRegister'] = true; } if ( isset( $edd_settings['addonify_recaptcha_for_edd_client_key'] ) && $edd_settings['addonify_recaptcha_for_edd_client_key'] ) { $args['clientSecreteKey'] = $edd_settings['addonify_recaptcha_for_edd_client_key']; } wp_localize_script( $this->plugin_name, 'addonifyRecaptchaArgs', $args ); wp_enqueue_script ( $this->plugin_name ); } public function g_recaptcha_script() { wp_enqueue_script( $this->plugin_name . '-recaptcha', 'https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit', array(), '', true ); } public function g_recaptcha_script_loader_tag( $tag, $handle, $src ) { if ( $this->plugin_name . '-recaptcha' === $handle ) { $tag = ''; } return $tag; } public function insert_recaptcha_element() { echo '

'; } }