0, 'ageverify_background' => '', 'ageverify_logoselect' => '', 'ageverify_logoheight' => '50', 'ageverify_template' => 'opaque', 'ageverify_underageredirect' => 'https://ageverify.com', 'ageverify_prompttext' => __( 'Welcome! Please verify
your age to enter.

Are you 21 years or older?', 'ageverify' ), 'ageverify_fontsize' => '24', 'ageverify_entertext' => __( 'Yes', 'ageverify' ), 'ageverify_exittext' => __( 'No', 'ageverify' ), 'ageverify_bfontsize' => '22', 'ageverify_yytext' => 'YYYY', 'ageverify_mmtext' => 'MM', 'ageverify_ddtext' => 'DD', 'ageverify_remembertext' => __( 'Remember Me', 'ageverify' ), 'ageverify_colorp' => '007000', 'ageverify_colors' => 'ffffff', 'ageverify_age' => '21', 'ageverify_method' => 'avp', 'ageverify_countup' => 0, 'ageverify_altbackground' => 'none', 'ageverify_altlogo' => 'none' ); $options = get_option('ageverify_settings'); return wp_parse_args( $options, $defaults ); } function ageverify_add_defaults() { $tmp = get_option( 'ageverify_settings' ); if ( ! is_array( $tmp ) ) { $arr = ageverify_get_options_with_defaults(); update_option( 'ageverify_settings', $arr ); } } // ------------------------------------------------------------------------------ // CALLBACK FUNCTION FOR: add_action('admin_init', 'ageverify_init' ) // ------------------------------------------------------------------------------ // THIS FUNCTION RUNS WHEN THE 'admin_init' HOOK FIRES, AND REGISTERS YOUR PLUGIN // SETTING WITH THE WORDPRESS SETTINGS API. YOU WON'T BE ABLE TO USE THE SETTINGS // API UNTIL YOU DO. // ------------------------------------------------------------------------------ // Init plugin options to white-list our options. function ageverify_init(){ register_setting( 'ageverify_plugin_options', 'ageverify_settings', 'ageverify_validate_options' ); } // ------------------------------------------------------------------------------ // CALLBACK FUNCTION FOR: add_action('admin_menu', 'ageverify_add_options_page'); // ------------------------------------------------------------------------------ // Add menu page function ageverify_add_options_page() { add_menu_page( 'AgeVerify', 'AgeVerify', 'manage_options', 'age-verify-options', 'ageverify_render_options_page', plugin_dir_url( __FILE__ ) . '/includes/AVicon20.png', 85.420 ); } // ------------------------------------------------------------------------------ // CALLBACK FUNCTION SPECIFIED IN: add_options_page() // ------------------------------------------------------------------------------ add_action( 'admin_init', 'ageverify_settings_init' ); function ageverify_settings_init( ) { register_setting( 'pluginPage', 'ageverify_settings' ); register_setting( 'customize', 'ageverify_settings' ); register_setting( 'moreFromImbibeDigital', 'ageverify_settings' ); add_settings_section( 'ageverify_pluginPage_section', '', 'ageverify_settings_section_callback', 'pluginPage' ); add_settings_field( 'ageverify_on', __( 'Enable or Disable AgeVerify', 'ageverify' ), 'ageverify_on_render', 'pluginPage', 'ageverify_pluginPage_section' ); add_settings_field( 'ageverify_background', '', 'ageverify_background_render', 'pluginPage', 'ageverify_pluginPage_section' ); add_settings_field( 'ageverify_template', '', 'ageverify_template_render', 'pluginPage', 'ageverify_pluginPage_section' ); add_settings_field( 'ageverify_prompttext', __( 'Age Verification Prompt Text', 'ageverify' ), 'ageverify_prompttext_render', 'pluginPage', 'ageverify_pluginPage_section' ); add_settings_field( 'ageverify_fontsize', __( 'Prompt Text Font Size', 'ageverify' ), 'ageverify_fontsize_render', 'pluginPage', 'ageverify_pluginPage_section' ); add_settings_field( 'ageverify_method', __( 'Select Age Verification Method', 'ageverify' ), 'ageverify_method_render', 'pluginPage', 'ageverify_pluginPage_section' ); add_settings_field( 'ageverify_entertext', __( 'Enter Button Text', 'ageverify' ), 'ageverify_entertext_render', 'pluginPage', 'ageverify_pluginPage_section' ); add_settings_field( 'ageverify_exittext', __( 'Exit Button Text', 'ageverify' ), 'ageverify_exittext_render', 'pluginPage', 'ageverify_pluginPage_section' ); add_settings_field( 'ageverify_bfontsize', __( 'Button Text Font Size', 'ageverify' ), 'ageverify_bfontsize_render', 'pluginPage', 'ageverify_pluginPage_section' ); add_settings_field( 'ageverify_yytext', __( 'Birth Year Input Placeholder Text', 'ageverify' ), 'ageverify_yytext_render', 'pluginPage', 'ageverify_pluginPage_section' ); add_settings_field( 'ageverify_mmtext', __( 'Birth Month Input Placeholder Text', 'ageverify' ), 'ageverify_mmtext_render', 'pluginPage', 'ageverify_pluginPage_section' ); add_settings_field( 'ageverify_ddtext', __( 'Birth Day Input Placeholder Text', 'ageverify' ), 'ageverify_ddtext_render', 'pluginPage', 'ageverify_pluginPage_section' ); add_settings_field( 'ageverify_age', __( 'Minimum Age for Entry', 'ageverify' ), 'ageverify_age_render', 'pluginPage', 'ageverify_pluginPage_section' ); add_settings_field( 'ageverify_remembertext', __( 'Remember Me Text', 'ageverify' ), 'ageverify_remembertext_render', 'pluginPage', 'ageverify_pluginPage_section' ); // customize tab add_settings_section( 'ageverify_customize_section', '', 'ageverify_customize_section_callback', 'customize' ); // More from Imbibe Digital tab add_settings_section( 'ageverify_moreFromImbibeDigital_section', '', 'ageverify_moreFromImbibeDigital_section_callback', 'moreFromImbibeDigital' ); } function ageverify_on_render() { $options = ageverify_get_options_with_defaults(); ?> value='1' >


  

__( 'Button Prompt
(over age / under age)', 'ageverify' ), "code" => "ABP" ), array( "name" => __( 'Date of Birth Input
(month / day / year)', 'ageverify' ), "code" => "MDY", ), array( "name" => __( 'Date of Birth Input
(day / month / year)', 'ageverify' ), "code" => "DMY", ) ); foreach( $methods as $method ) { ?> ' id='' onclick='methodSelect();' >

' > px
px;color:#fff;margin-bottom:20px;text-align:center;box-shadow: #777 2px 2px 4px;background-color:#007000;border: 2px solid #007000;' type='text' id='entertext' maxlength='24' name='ageverify_settings[ageverify_entertext]' value='' >
px;color:#fff;margin-bottom:20px;text-align:center;background-color:#007000;border: 2px solid #007000;' type='text' id='exittext' maxlength='24' name='ageverify_settings[ageverify_exittext]' value='' > ' >px
' >
' >
' >

' > ' >

$val ) { switch ( $key ) { case 'ageverify_countup': case 'ageverify_on': $safe_input[ $key ] = (bool)$val; break; case 'ageverify_ddtext': case 'ageverify_logoselect': case 'ageverify_entertext': case 'ageverify_exittext': case 'ageverify_yytext': case 'ageverify_mmtext': case 'ageverify_remembertext': case 'ageverify_background': $safe_input[ $key ] = sanitize_text_field( $val ); break; case 'ageverify_fontsize': case 'ageverify_bfontsize': case 'ageverify_age': case 'ageverify_logoheight': $safe_input[ $key ] = intval( $val ); break; case 'ageverify_template': $safe_input[ $key ] = ageverify_template_name_whitelist( $val ); break; case 'ageverify_altbackground': case 'ageverify_altlogo': case 'ageverify_underageredirect': $safe_input[ $key ] = sanitize_url( $val ); break; case 'ageverify_prompttext': $safe_input[ $key ] = wp_kses_post( $val ); break; case 'ageverify_colors': case 'ageverify_colorp': $safe_input[ $key ] = sanitize_hex_color( $val ); break; case 'ageverify_method': $methods = array( 'MDY', 'DMY', 'ABP' ); if ( !in_array( $val, $methods ) ) { $val = 'AVP'; } $safe_input[ $key ] = $val; break; } } return $safe_input; } function ageverify_template_name_whitelist( $template_name ) { require_once( plugin_dir_path( __FILE__ ) . 'includes/templates.php' ); foreach ( $templates as $template ) { if ( isset( $template['name'] ) && $template['name'] == $template_name ) { return $template_name; } } return 'opaque'; }