' ; 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 ) { $option_name = $args['option_name']; if ( !empty($option_name) ) { $options = get_option( $option_name, array() ); } else { $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 ) { $option_name = $args['option_name']; if ( !empty($option_name) ) { $options = get_option( $option_name, array() ); } else { $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 ) { $option_name = $args['option_name']; if ( !empty($option_name) ) { $options = get_option( $option_name, array() ); } else { $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 ) { $option_name = $args['option_name']; if ( !empty($option_name) ) { $options = get_option( $option_name, array() ); } else { $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_placeholder = ( isset( $args['field_placeholder'] ) ? $args['field_placeholder'] : '' ); $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' ) { $field_placeholder = 'e.g. backend'; } elseif ( $field_id == 'redirect_after_login_to_slug' ) { $field_placeholder = 'e.g. my-account'; } elseif ( $field_id == 'redirect_after_logout_to_slug' ) { $field_placeholder = 'e.g. come-visit-again'; } elseif ( $field_id == 'login_fails_allowed' ) { $field_placeholder = '3'; } elseif ( $field_id == 'login_lockout_maxcount' ) { $field_placeholder = '3'; } else { } echo $field_prefix . '' . $field_suffix ; echo '' ; } /** * Render description field as sub-field of a toggle/switcher checkbox * * @since 4.6.0 */ function render_description_subfield( $args ) { $field_description = $args['field_description']; echo '
' . $field_description . '
' ; } /** * Render heading for sub-fields of a toggle/switcher checkbox * * @since 5.0.0 */ function render_subfields_heading( $args ) { $subfields_heading = $args['subfields_heading']; echo '
' . $subfields_heading . '
' ; } /** * Render password field as sub-field of a toggle/switcher checkbox * * @since 4.1.0 */ function render_password_subfield( $args ) { $option_name = $args['option_name']; if ( !empty($option_name) ) { $options = get_option( $option_name, array() ); } else { $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 ) { $option_name = $args['option_name']; if ( !empty($option_name) ) { $options = get_option( $option_name, array() ); } else { $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 = ( isset( $args['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 == 'custom_frontend_css_priority' || $field_id == 'head_code_priority' || $field_id == 'body_code_priority' || $field_id == 'footer_code_priority' ) { $placeholder = '10'; } elseif ( $field_id == 'convert_to_webp_quality' ) { $placeholder = '82'; } 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 ) { $option_name = $args['option_name']; if ( !empty($option_name) ) { $options = get_option( $option_name, array() ); } else { $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 ) { $option_name = $args['option_name']; if ( !empty($option_name) ) { $options = get_option( $option_name, array() ); } else { $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_rows = $args['field_rows']; $field_intro = $args['field_intro']; $field_description = $args['field_description']; $field_placeholder = ( isset( $args['field_placeholder'] ) ? $args['field_placeholder'] : '' ); // 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 test email subfield for Email Delivery module * * @since 5.3.0 */ function render_custom_html( $args ) { // name attribute is emptied so this input will be excluded from saving into ASENHA option echo $args['html'] ; } /** * Render media subfield * * @since 6.2.2 */ function render_media_subfield( $args ) { $field_id = $args['field_id']; $field_slug = $args['field_slug']; $field_name = $args['field_name']; $field_media_frame_title = $args['field_media_frame_title']; $field_media_frame_multiple = $args['field_media_frame_multiple']; $field_media_frame_library_type = $args['field_media_frame_library_type']; $field_media_frame_button_text = $args['field_media_frame_button_text']; $field_intro = $args['field_intro']; $field_description = $args['field_description']; $options = get_option( $args['option_name'], array() ); $field_option_value = ( isset( $options[$field_id] ) ? $options[$field_id] : '' ); ?>
Drag and drop menu items to the desired position. Optionally change 3rd party plugin/theme's menu item titles or hide some items until toggled by clicking "Show All" at the bottom of the admin menu.
' ; // Hidden input field to store custom menu titles (from options as is, or custom values entered on each non-WP-default menu items. $field_id = 'custom_menu_titles'; $field_name = ASENHA_SLUG_U . '[' . $field_id . ']'; $field_option_value = ( isset( $options[$field_id] ) ? $options[$field_id] : '' ); echo '' ; // Hidden input field to store hidden menu items (from options as is, or 'Hide' checkbox clicks) upon clicking Save Changes. $field_id = 'custom_menu_hidden'; $field_name = ASENHA_SLUG_U . '[' . $field_id . ']'; $field_option_value = ( isset( $options[$field_id] ) ? $options[$field_id] : '' ); echo '' ; } /** * Render textarea field as sub-field of a toggle/switcher checkbox * * @since 2.3.0 */ function render_datatable( $args ) { global $wpdb ; $option_name = $args['option_name']; if ( !empty($option_name) ) { $options = get_option( $option_name, array() ); } else { $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



' ; } /** * Render checks and status for AVIF support * * @link https://php.watch/versions/8.1/gd-avif * @since 5.7.0 */ public function render_avif_support_status() { // Check status of GD extension and it's AVIF support if ( extension_loaded( 'gd' ) && function_exists( 'gd_info' ) ) { $is_gd_enabled = true; $gd_info = gd_info(); $gd_version = $gd_info['GD Version']; $gd_avif_support = ( isset( $gd_info['AVIF Support'] ) ? isset( $gd_info['AVIF Support'] ) : false ); if ( $gd_avif_support ) { $gd_status = $gd_version . ' with AVIF support'; } else { $gd_status = $gd_version . ' without AVIF support'; } } else { $is_gd_enabled = false; $gd_avif_support = false; $gd_status = 'Not available'; } // Check status of ImageMagick library and it's AVIF support if ( extension_loaded( 'imagick' ) && class_exists( 'Imagick' ) ) { $is_imagick_enabled = true; $imagick_version = \Imagick::getVersion(); if ( preg_match( '/((?:[0-9]+\\.?)+)/', $imagick_version['versionString'], $matches ) ) { $imagick_version = $matches[0]; } else { $imagick_version = $imagick_version['versionString']; } if ( version_compare( $imagick_version, '7.0.25', '>=' ) ) { $imagick_avif_support = true; $imagick_status = $imagick_version . ' with AVIF support'; } else { $imagick_avif_support = false; $imagick_status = $imagick_version . ' without AVIF support'; } } else { $is_imagick_enabled = false; $imagick_avif_support = false; $imagick_status = 'Not available'; } echo '
' ; echo '
AVIF Support Status
' ; echo '
' ; echo '
PHP : ' . wp_kses_post( phpversion() ) . '
' ; echo '
GD : ' . wp_kses_post( $gd_status ) . '
' ; echo '
ImageMagick : ' . wp_kses_post( $imagick_status ) . '
' ; echo '
' ; echo '' ; echo '
' ; } }