'General Settings' ); $tabs = apply_filters( 'all_in_one_invite_codes_admin_tabs', $tabs ); $tabs['mail'] = 'Mail Templates'; echo ''; } /** * Register Settings Options */ function all_in_one_invite_codes_register_option() { // General Settings. register_setting( 'all_in_one_invite_codes_general', 'all_in_one_invite_codes_general', array( 'sanitize_callback' => 'all_in_one_invite_codes_sanitize_general' ) ); // Mail Templates. register_setting( 'all_in_one_invite_codes_mail_templates', 'all_in_one_invite_codes_mail_templates', array( 'sanitize_callback' => 'all_in_one_invite_codes_sanitize_mail_templates' ) ); } add_action( 'admin_init', 'all_in_one_invite_codes_register_option' ); /** * Sanitize the general settings option. * * @param array|null $input * @return array */ function all_in_one_invite_codes_sanitize_general( $input ) { $out = array(); if ( ! is_array( $input ) ) { return $out; } if ( isset( $input['default_registration'] ) ) { $out['default_registration'] = in_array( $input['default_registration'], array( 'enabled', 'disable' ), true ) ? $input['default_registration'] : 'disable'; } if ( isset( $input['generate_codes_amount'] ) ) { $out['generate_codes_amount'] = (string) absint( $input['generate_codes_amount'] ); } if ( isset( $input['character_length'] ) ) { $out['character_length'] = (string) max( 5, absint( $input['character_length'] ) ); } return $out; } /** * Sanitize the mail templates option. Subject is plain text; message bodies allow HTML * within wp_kses_post() since admins regularly drop in formatted notification copy. * * @param array|null $input * @return array */ function all_in_one_invite_codes_sanitize_mail_templates( $input ) { $out = array(); if ( ! is_array( $input ) ) { return $out; } if ( isset( $input['subject'] ) ) { $out['subject'] = sanitize_text_field( $input['subject'] ); } foreach ( $input as $key => $value ) { if ( 'subject' === $key ) { continue; } $out[ sanitize_key( $key ) ] = wp_kses_post( $value ); } return $out; } /** * * Tabs content with the options */ function all_in_one_invite_codes_settings_page_tabs_content() { global $pagenow, $all_in_one_invite_codes; if ( ! current_user_can( 'manage_options' ) ) { return; } // All inputs here come from the WP-rendered admin URL on a read-only screen // (tab routing + post-save banner). Capability check above is the gate; // no nonce is required to render the screen. // phpcs:disable WordPress.Security.NonceVerification.Recommended -- read-only admin screen routing; capability checked above. $page_param = isset( $_GET['page'] ) ? sanitize_key( wp_unslash( $_GET['page'] ) ) : ''; $tab = isset( $_GET['tab'] ) ? sanitize_key( wp_unslash( $_GET['tab'] ) ) : 'general'; $updated = isset( $_GET['updated'] ) ? sanitize_key( wp_unslash( $_GET['updated'] ) ) : ''; // phpcs:enable WordPress.Security.NonceVerification.Recommended ?>

All in One Invite Codes...

'; } all_in_one_invite_codes_admin_tabs( $tab ); if ( $pagenow === 'edit.php' && 'all_in_one_invite_codes_settings' === $page_param ) { switch ( $tab ) { case 'general': $all_in_one_invite_codes_general = get_option( 'all_in_one_invite_codes_general' ); if ( empty( $all_in_one_invite_codes_general ) ) { $all_in_one_invite_codes_general = array( 'default_registration' => 'enabled', 'generate_codes_amount' => '5', 'character_length' => '5', ); add_option( 'all_in_one_invite_codes_general', $all_in_one_invite_codes_general, '', 'yes' ); } ?>

'; foreach ( $pages as $page_id => $page_name ) { echo ''; } echo ''; } ?>
$description ) { $template_message = empty( $all_in_one_invite_codes_mail_templates[ $key ] ) ? $message_text_default : $all_in_one_invite_codes_mail_templates[ $key ]; echo ''; echo ''; echo ''; echo ''; } ?>

  • [site_name]
  • [invite_code]
  • [invite_link]
' . esc_html( $description ) . ''; echo ''; echo '