get_cookie(); $options = IP_Geo_Block::get_option(); $plugin_slug = IP_Geo_Block::PLUGIN_NAME; register_setting( $option_slug = IP_Geo_Block::PLUGIN_NAME, $option_name = IP_Geo_Block::OPTION_NAME ); /*----------------------------------------* * Validation logs *----------------------------------------*/ add_settings_section( $section = $plugin_slug . '-logs', array( __( 'Validation logs', 'ip-geo-block' ), '' . __( 'Help', 'ip-geo-block' ) . '' ), ( $options['validation']['reclogs'] ? array( __CLASS__, 'validation_logs' ) : array( __CLASS__, 'warn_accesslog' ) ), $option_slug ); if ( $options['validation']['reclogs'] ): if ( extension_loaded( 'pdo_sqlite' ) ): $html = ''; // Live update add_settings_field( $option_name.'_live-log', __( 'Live update', 'ip-geo-block' ) . '
', array( $context, 'callback_field' ), $option_slug, $section, array( 'type' => 'html', 'option' => $option_name, 'field' => 'live-log', 'value' => $html, 'class' => isset( $cookie[ $tab ][1] ) && $cookie[ $tab ][1] === 'o' ? '' : 'ip-geo-block-hide', ) ); endif; // extension_loaded( 'pdo_sqlite' ) // make a list of target (same as in tab-accesslog.php) $target = array( 'comment' => __( 'Comment post', 'ip-geo-block' ), 'xmlrpc' => __( 'XML-RPC', 'ip-geo-block' ), 'login' => __( 'Login form', 'ip-geo-block' ), 'admin' => __( 'Admin area', 'ip-geo-block' ), 'public' => __( 'Public facing pages', 'ip-geo-block' ), ); $html = "\n".'
  • ' . "\n"; foreach ( $target as $key => $val ) { $html .= '
  • ' . "\n"; } // Select target add_settings_field( $option_name.'_select_target', __( 'Select target', 'ip-geo-block' ), array( $context, 'callback_field' ), $option_slug, $section, array( 'type' => 'html', 'option' => $option_name, 'field' => 'select_target', 'value' => '', ) ); // Search in logs add_settings_field( $option_name.'_search_filter', __( 'Search in logs', 'ip-geo-block' ), array( $context, 'callback_field' ), $option_slug, $section, array( 'type' => 'text', 'option' => $option_name, 'field' => 'search_filter', 'value' => isset( $_GET['s'] ) ? esc_html( $_GET['s'] ) : '', // preset filter 'after' => ''. __( 'Reset', 'ip-geo-block' ) . '', ) ); // Preset filters $filters = has_filter( $plugin_slug . '-logs-preset' ) ? apply_filters( $plugin_slug . '-logs-preset', array() ) : $context->preset_filters(); if ( ! empty( $filters ) ) { // allowed tags and attributes $allow_tags = array( 'span' => array( 'class' => 1, 'title' => 1, ) ); $html = '