'; echo ''; // For field with additional options / sub-fields, we add a wrapper to enclose field descriptions if ( array_key_exists( 'field_options_wrapper', $args ) && $args['field_options_wrapper'] ) { // For when the options / sub-fields occupy lengthy vertical space, we add show all / less toggler if ( array_key_exists( 'field_options_moreless', $args ) && $args['field_options_moreless'] ) { echo '
'; echo 'Expand ▼'; echo '
'; } else { echo '
'; echo '
'; } } echo '
' . wp_kses_post( $field_description ) . '
'; // For field with additional options / sub-fields, we add wrapper for them if ( array_key_exists( 'field_options_wrapper', $args ) && $args['field_options_wrapper'] ) { echo ''; } // For field with additional options / sub-fields, we add a wrapper to enclose field descriptions if ( array_key_exists( 'field_options_wrapper', $args ) && $args['field_options_wrapper'] ) { echo '
'; echo '
'; } } /** * Render checkbox field as sub-field of a toggle/switcher checkbox * * @since 1.9.0 */ function render_checkbox_plain( $args ) { $options = get_option( ASENHA_SLUG_U, array() ); $field_name = $args['field_name']; $field_label = $args['field_label']; $field_option_value = ( isset( $options[$args['field_id']] ) ) ? $options[$args['field_id']] : false; echo ''; echo ''; } /** * Render checkbox field as sub-field of a toggle/switcher checkbox * * @since 1.3.0 */ function render_checkbox_subfield( $args ) { $options = get_option( ASENHA_SLUG_U, array() ); $field_name = $args['field_name']; $field_label = $args['field_label']; $field_option_value = ( isset( $options[$args['parent_field_id']][$args['field_id']] ) ) ? $options[$args['parent_field_id']][$args['field_id']] : false; echo ''; echo ''; } /** * Render radio buttons field as sub-field of a toggle/switcher checkbox * * @since 1.3.0 */ function render_radio_buttons_subfield( $args ) { $options = get_option( ASENHA_SLUG_U, array() ); $field_id = $args['field_id']; $field_name = $args['field_name']; // $field_label = $args['field_label']; $field_radios = $args['field_radios']; if ( ! empty( $args['field_default'] ) ) { $default_value = $args['field_default']; } else { $default_value = false; } $field_option_value = ( isset( $options[$field_id] ) ) ? $options[$field_id] : $default_value; foreach ( $field_radios as $radio_label => $radio_value ) { echo ''; echo ''; } } /** * Render text field as sub-field of a toggle/switcher checkbox * * @since 1.4.0 */ function render_text_subfield( $args ) { $options = get_option( ASENHA_SLUG_U, array() ); $field_id = $args['field_id']; $field_name = $args['field_name']; $field_type = $args['field_type']; $field_prefix = $args['field_prefix']; $field_suffix = $args['field_suffix']; $field_description = $args['field_description']; $field_option_value = ( isset( $options[$args['field_id']] ) ) ? $options[$args['field_id']] : ''; if ( ! empty( $field_prefix ) && ! empty( $field_suffix ) ) { $field_classname = ' with-prefix with-suffix'; } elseif ( ! empty( $field_prefix ) && empty( $field_suffix ) ) { $field_classname = ' with-prefix'; } elseif ( empty( $field_prefix ) && ! empty( $field_suffix ) ) { $field_classname = ' with-suffix'; } else { $field_classname = ''; } if ( $field_id == 'custom_login_slug' ) { $placeholder = 'e.g. backend'; } elseif ( $field_id == 'redirect_after_login_to_slug' ) { $placeholder = 'e.g. my-account'; } elseif ( $field_id == 'redirect_after_logout_to_slug' ) { $placeholder = 'e.g. come-visit-again'; } elseif ( $field_id == 'login_fails_allowed' ) { $placeholder = '3'; } elseif ( $field_id == 'login_lockout_maxcount' ) { $placeholder = '3'; } else { $placeholder = ''; } echo $field_prefix . '' . $field_suffix; echo ''; } /** * Render password field as sub-field of a toggle/switcher checkbox * * @since 4.1.0 */ function render_password_subfield( $args ) { $options = get_option( ASENHA_SLUG_U, array() ); $field_id = $args['field_id']; $field_name = $args['field_name']; $field_type = $args['field_type']; $field_prefix = $args['field_prefix']; $field_suffix = $args['field_suffix']; $field_description = $args['field_description']; $field_option_value = ( isset( $options[$args['field_id']] ) ) ? $options[$args['field_id']] : ''; if ( ! empty( $field_prefix ) && ! empty( $field_suffix ) ) { $field_classname = ' with-prefix with-suffix'; } elseif ( ! empty( $field_prefix ) && empty( $field_suffix ) ) { $field_classname = ' with-prefix'; } elseif ( empty( $field_prefix ) && ! empty( $field_suffix ) ) { $field_classname = ' with-suffix'; } else { $field_classname = ''; } $placeholder = ''; echo $field_prefix . '' . $field_suffix; echo ''; } /** * Render number field as sub-field of a toggle/switcher checkbox * * @since 1.4.0 */ function render_number_subfield( $args ) { $options = get_option( ASENHA_SLUG_U, array() ); $field_id = $args['field_id']; $field_name = $args['field_name']; $field_type = $args['field_type']; $field_prefix = $args['field_prefix']; $field_suffix = $args['field_suffix']; $field_intro = $args['field_intro']; $field_description = $args['field_description']; $field_option_value = ( isset( $options[$args['field_id']] ) ) ? $options[$args['field_id']] : ''; if ( ! empty( $field_prefix ) && ! empty( $field_suffix ) ) { $field_classname = ' with-prefix with-suffix'; } elseif ( ! empty( $field_prefix ) && empty( $field_suffix ) ) { $field_classname = ' with-prefix'; } elseif ( empty( $field_prefix ) && ! empty( $field_suffix ) ) { $field_classname = ' with-suffix'; } else { $field_classname = ''; } if ( ( $field_id == 'revisions_max_number' ) || ( $field_id == 'head_code_priority' ) || ( $field_id == 'body_code_priority' ) || ( $field_id == 'footer_code_priority' ) ) { $placeholder = '10'; } else { $placeholder = ''; } echo '
'; if ( ! empty( $field_intro ) ) { echo '
' . wp_kses_post( $field_intro ) . '
'; } echo '
' . $field_prefix . '' . $field_suffix . '
'; if ( ! empty( $field_description ) ) { echo '
' . wp_kses_post( $field_description ) . '
'; } echo '
'; } /** * Render select field as sub-field of a toggle/switcher checkbox * * @since 1.4.0 */ function render_select_subfield( $args ) { $options = get_option( ASENHA_SLUG_U, array() ); $field_id = $args['field_id']; $field_name = $args['field_name']; $field_type = $args['field_type']; $field_prefix = $args['field_prefix']; $field_suffix = $args['field_suffix']; $field_select_options = $args['field_select_options']; $field_select_default = $args['field_select_default']; $field_intro = $args['field_intro']; $field_description = $args['field_description']; if ( ! empty( $args['field_select_default'] ) ) { $default_value = $args['field_select_default']; } else { $default_value = false; } $field_option_value = ( isset( $options[$field_id] ) ) ? $options[$field_id] : $default_value; if ( ! empty( $field_prefix ) && ! empty( $field_suffix ) ) { $field_classname = ' with-prefix with-suffix'; } elseif ( ! empty( $field_prefix ) && empty( $field_suffix ) ) { $field_classname = ' with-prefix'; } elseif ( empty( $field_prefix ) && ! empty( $field_suffix ) ) { $field_classname = ' with-suffix'; } else { $field_classname = ''; } if ( $args['display_none_on_load'] ) { $inline_style = ' style="display:none;"'; } else { $inline_style = ''; } echo '
'; if ( ! empty( $field_intro ) ) { echo '
' . wp_kses_post( $field_intro ) . '
'; } echo '' . $field_prefix; echo ''; echo $field_suffix . '
'; if ( ! empty( $field_description ) ) { echo '
' . wp_kses_post( $field_description ) . '
'; } echo '
'; } /** * Render textarea field as sub-field of a toggle/switcher checkbox * * @since 2.3.0 */ function render_textarea_subfield( $args ) { $options = get_option( ASENHA_SLUG_U, array() ); $field_id = $args['field_id']; $field_slug = $args['field_slug']; $field_name = $args['field_name']; $field_type = $args['field_type']; $field_intro = $args['field_intro']; $field_description = $args['field_description']; // Always load textarea content from robots.txt URL, whether it's a real, custom-made robots.txt file or a virtual one generated by WordPress if ( 'robots_txt_content' == $field_id ) { if ( array_key_exists( 'manage_robots_txt', $options ) ) { if ( ! $options['manage_robots_txt'] ) { // Manage robots.txt feature is NOT enabled if ( array_key_exists( 'robots_txt_content', $options ) && $options['robots_txt_content'] ) { $field_option_value = $options['robots_txt_content']; } else { $robots_txt_content = wp_remote_get( get_site_url() . '/robots.txt' ); $robots_txt_content = esc_textarea( trim( wp_remote_retrieve_body( $robots_txt_content ) ) ); $field_option_value = $robots_txt_content; } } else { // Manage robots.txt feature is enabled if ( array_key_exists( 'robots_txt_content', $options ) && $options['robots_txt_content'] ) { $field_option_value = $options['robots_txt_content']; } else { $robots_txt_content = wp_remote_get( get_site_url() . '/robots.txt' ); $robots_txt_content = esc_textarea( trim( wp_remote_retrieve_body( $robots_txt_content ) ) ); $field_option_value = $robots_txt_content; } } } else { // Manage robots.txt feature has never been enabled yet $robots_txt_content = wp_remote_get( get_site_url() . '/robots.txt' ); $robots_txt_content = esc_textarea( trim( wp_remote_retrieve_body( $robots_txt_content ) ) ); $field_option_value = $robots_txt_content; } } else { $field_option_value = ( isset( $options[$args['field_id']] ) ) ? $options[$args['field_id']] : ''; } echo '
'; if ( ! empty( $field_intro ) ) { echo '
' . wp_kses_post( $field_intro ) . '
'; } echo ''; if ( ! empty( $field_description ) ) { echo '
' . wp_kses_post( $field_description ) . '
'; } echo '
'; } /** * Render sortable menu field * * @since 2.0.0 */ function render_sortable_menu( $args ) { ?>
Drag and drop menu items to the desired position. Optionally change item titles or hide some items until "Show All" at the bottom of the admin menu is clicked.
'; $field_id = 'custom_menu_titles'; $field_name = ASENHA_SLUG_U . '['. $field_id .']'; $field_option_value = ( isset( $options[$field_id] ) ) ? $options[$field_id] : ''; // Hidden input field to store custom menu titles (from options as is, or custom values entered on each non-WP-default menu items. echo ''; $field_id = 'custom_menu_hidden'; $field_name = ASENHA_SLUG_U . '['. $field_id .']'; $field_option_value = ( isset( $options[$field_id] ) ) ? $options[$field_id] : ''; // Hidden input field to store hidden menu itmes (from options as is, or 'Hide' checkbox clicks) upon clicking Save Changes. echo ''; } /** * Render textarea field as sub-field of a toggle/switcher checkbox * * @since 2.3.0 */ function render_datatable( $args ) { global $wpdb; $options = get_option( ASENHA_SLUG_U, array() ); $field_id = $args['field_id']; $field_slug = $args['field_slug']; $field_name = $args['field_name']; $field_type = $args['field_type']; $field_description = $args['field_description']; $table_title = $args['table_title']; $table_name = $args['table_name']; $field_option_value = ( isset( $options[$args['field_id']] ) ) ? $options[$args['field_id']] : ''; ?> prepare( "SELECT * FROM {$table_name} ORDER BY unixtime DESC LIMIT %d", array( $limit ) ); $entries = $wpdb->get_results( $sql, ARRAY_A ); foreach( $entries as $entry ) { $unixtime = $entry['unixtime']; if ( function_exists( 'wp_date' ) ) { $date = wp_date( 'F j, Y', $unixtime ); $time = wp_date( 'H:i:s', $unixtime ); } else { $date = date_i18n( 'F j, Y', $unixtime ); $time = date_i18n( 'H:i:s', $unixtime ); } ?>
IP Address
Last Username
Attempts
Lockouts
Last Attempt On



'; } }