`: the key * field is saved by the same Save button as every other setting, and the field helper defined there * (`mybot_field_secret()`) draws it, so a stored secret is masked the same way everywhere. * * Until 1.11.0 this was a top-level screen of its own, "AI House → Add-ons". It moved into Settings * because it is a setting, and because two menu entries describing the same plugins meant the answer * to "how do I switch this on?" lived on a different screen from every other answer. * * @package AI House */ defined( 'ABSPATH' ) || exit; $mybot_addons = mybot()->addons; $mybot_known = $mybot_addons->all(); $mybot_rejected = $mybot_addons->problems(); $mybot_settings = mybot()->settings; $mybot_key_status = (string) $mybot_settings->get( 'addon_key_status', '' ); $mybot_key_problem = (string) $mybot_settings->get( 'addon_key_problem', '' ); $mybot_key_checked = (int) $mybot_settings->get( 'addon_key_checked_at', 0 ); /* * The verdict, asked again on every render instead of replayed from the database. * * The stored status records what was true when the button was pressed. A key can expire, and an * add-on can be deactivated between one page load and the next — a card that replayed "Licensed" for * a key that lapsed last week would be reporting something nobody checked. Asking again is cheap: * the answer comes from the add-on, which caches its own result for five minutes. * * 1.22.4 is the first release where this can be anything other than the shape verdict, because it is * the first where an add-on is asked at all (`MYBOT_Settings::addon_key_verdict()`). */ $mybot_key_live = $mybot_settings->addon_key_verdict( (string) $mybot_settings->secret( 'addon_key' ) ); $mybot_key_state = (string) $mybot_key_live['status']; /* * The verdict, in words. * * The stored value is a CODE, not a sentence: a message written into the database is a message * frozen in whatever language the administrator was using on the day they pressed the button. The * code is turned into a sentence here, at the moment it is read — and the one sentence that does come * from the add-on is asked for again here, so it is in today's language too. */ $mybot_key_message = ''; $mybot_key_tone = 'info'; if ( 'empty' === $mybot_key_state ) { $mybot_key_message = $mybot_key_checked < 1 ? __( 'Not checked yet.', 'aihouse' ) : __( 'Nothing was entered, so there was nothing to check.', 'aihouse' ); } elseif ( 'shape-bad' === $mybot_key_state ) { $mybot_key_tone = 'error'; $mybot_key_reasons = array( 'too-short' => __( 'it is shorter than the shortest key this plugin accepts.', 'aihouse' ), 'too-long' => __( 'it is longer than the longest key this plugin accepts.', 'aihouse' ), 'bad-characters' => __( 'it contains something other than letters, digits, dots, dashes or underscores.', 'aihouse' ), ); $mybot_key_reason = isset( $mybot_key_reasons[ $mybot_key_problem ] ) ? $mybot_key_reasons[ $mybot_key_problem ] : __( 'the reason was not recorded.', 'aihouse' ); $mybot_key_message = sprintf( /* translators: %s: why the key was rejected, as a short clause */ __( 'The key does not look like a key: %s', 'aihouse' ), $mybot_key_reason ); } elseif ( 'verified' === $mybot_key_state || 'refused' === $mybot_key_state ) { $mybot_key_tone = ( 'verified' === $mybot_key_state ) ? 'ok' : 'error'; $mybot_key_said = (string) $mybot_key_live['message']; if ( '' === $mybot_key_said ) { $mybot_key_said = ( 'verified' === $mybot_key_state ) ? __( 'The add-on accepted this key.', 'aihouse' ) : __( 'The add-on refused this key without saying why.', 'aihouse' ); } if ( 'verified' === $mybot_key_state && '' !== (string) $mybot_key_live['verifier_name'] ) { $mybot_key_message = sprintf( /* translators: 1: the name of the add-on that verified the key, 2: its verdict */ __( 'Checked by %1$s. %2$s', 'aihouse' ), (string) $mybot_key_live['verifier_name'], $mybot_key_said ); } else { $mybot_key_message = $mybot_key_said; } } else { $mybot_key_tone = 'ok'; $mybot_key_message = __( 'The shape is right — and nothing has been verified, because no installed add-on on this site checks a key of this kind.', 'aihouse' ); } ?>

0 ) : ?>




' . esc_html__( 'Plugins', 'aihouse' ) . '' ); ?>

mybot_register_addons' ); ?>

' . esc_html( (string) MYBOT_ADDON_API ) . '', 'MYBOT_ADDON_API' ); ?>